Home > Data Services > Catalog . Restricted Data . Census . ACS

Search Data Services

Meta Search
search across all the following databases:

Data Catalog
Data and documentation

KnowledgeBase
Common questions and answers.

Resources
Entire collection of data resources.


Latest Data News

RSS Feed icon

Lessons from North of the Border

Nerd Alert: Dictionary of Numbers

International Migration Statistics for the US

Open Data Executive Order

Measuring Marriage & Divorce among Same-Sex Couples

Selecting a person based on the characteristics of others in the household: Number of persons in the household is not known

This is an example of a program that selects a person into the sample if anyone in the household is foreign born.

This example does not require that there is a variable that provides a count of the number of persons in the household.

In this example, the number of foreign born persons is summed over a household (using household ID). This count is merged with the rest of the person record and records are then kept on the basis of the fbcount variable.

See for an example of a program that takes advantage of a variable that provides a count of the number of persons in the household.

*******************************************************************;
filename pums90  pipe 'zcat
/usr/data/public/us/government/pums/1990/5pct/tx48.Z
';
/* INPUT data */
data a;
   retain state persons fborn;
   infile pums90;
   input @1 type $1. @;
   if type='H' then do;
        input serial 2-8  state $11-12;
        fborn=0;
        return;
      end;
   else do;
    input relat 9-10  sex 11  age 15-16  pwgt 18-21  rpob 29-30;
        count=0;
        end;
   if rpob ge 51 then foreign=1; else foreign=0;
run;
   proc sort data=a; by serial;
run;
   proc means noprint data=a;
     by serial;
   var foreign;
   output out=sumdat sum(foreign)=fhhld;
   run;
   data new;
     merge a sumdat (keep=serial state fhhld);
     by serial;
run;
   data result;
     set new;
     if fhld eq 0 then delete;
   data out;
     set result;
   file ex4a;
   put serial 1-7  rpot 9-10  foreign 12-12  fhhld 14-15;
run;