BookmarkSubscribeRSS Feed
kamorrow
Calcite | Level 5
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.
2 REPLIES 2
Paige
Quartz | Level 8
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
Dale
Pyrite | Level 9
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;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1080 views
  • 0 likes
  • 3 in conversation