Programming the statistical procedures from SAS

Check a row for multiple variables.

Posts: 1

Check a row for multiple variables.

I have rows that look like:
Person YOB_1 YOB_2 YOB_3
1 2000 2001 2002
2 2001 . .
3 2000 2002 2000

I want to figure out how to select only those people who have a data for every year of birth, 2000-2002.
Super Contributor
Posts: 281

Re: Check a row for multiple variables.

People can have multiple years of birth?

Are you asking to find where a row has all three years 2000 2001 2002 or where a row has values for all three variables YOB_1 YOB_2 YOB_3? Message was edited by: Paige
Regular Contributor
Posts: 171

Re: Check a row for multiple variables.

Paige raises some good questions. How does one get multiple years of birth? Also, the problem specification does seem to be a little lacking.

But if we are to select for either of the conditions which Paige enumerates, we can do so quite easily. If it is the first condition that we want to select data for (that the years 2000, 2001, and 2002 are all represented among the variables YOB_1, YOB_2, and YOB_3), then one could select those records (for a data step or within a procedure) by using the following WHERE statement:

where std(yob_1,yob_2,yob_3)=std(2001,2002,2003);

If it is desired to select persons who have nonmissing data for every variable YOB_1 through YOB_3, then the above WHERE statement could be replaced with

where nmiss(yob_1,yob_2,yob_3)=0;
Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation