Selecting a person based on the characteristics of others in the household: Number of persons in the household is 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 requires that there is a variable that provides a count of the number of persons in the household.

See the following for an example of a program that doesn't require this assumption.

*******************************************************************;
filename pums90  pipe 'zcat
/usr/data/public/us/government/pums/1990/5pct/tx48.Z
';
filename out1 'exer4.dat';
/* INPUT data */
data a;
   retain state persons fborn;
   infile pums90;
   array age(29) age1-age29;
   array sex(29) sex1-sex29;
   array rpob(29) rpob1-rpob29;
   array pwgt(29) pwgt1-pwgt29;
   input @1 type $1. @;
   if type='H' then do;
        input state $11-12  persons 33-34;
        fborn=0;
        return;
      end;
   else do i=1 to persons;
    input relat(i) 9-10 sex(i) 11 age(i) 15-16 pwgt(i) 18-21 rpob(i) 29-30
;
   if rpob(i)>=51 then fborn=fborn+1;
        end;
        if fborn>=1 then do i=1 to persons;
           file out1;
           put state $1-2 age(i) 4-5 sex(i) 7 rpob(i) 9-10  pwgt(i) 12-15;
           output;
        end;
run;

NEW PSC blog

Recent resources, events, news

New Publications

Knodel et al. "Gendered Housework in Vietnam." PSC Research Report.

Couper. Designing Effective Web Surveys

Next Brown Bag

Monday, Oct 13
Jamie Jones
"Fertility & Risk Aversion on Utah Frontier"


W A R N I N G

If you are reading this, it may be that you are using rather old web browsing software that does not support modern international Web technology standards. For a better experience of the Web and this site in particular, please upgrade your web browser software today. The following are good choices: Firefox 2; Opera 9; Safari 3.