Hi all,
I have a data set with 2 observations per person, in long format, and I want to select people of a certain age at T1 and a certain place of residence at T1, plus their T2 record, where residence may have changed. I can figure out how to select all the T1 records I want, but not the associated T2 record – any help would be much appreciated!
Sure
ID | Household ID | year of interview | Age at interview | residence | etc | etc |
1 | 1 | 2004 | 46 | 1 | ||
1 | 1 | 2006 | 48 | 1 | ||
2 | 1 | 2004 | 67 | 1 | ||
2 | 1 | 2006 | 69 | 2 | ||
3 | 2 | 2004 | 78 | 3 | ||
3 | 2 | 2006 | 79 | 3 | ||
4 | 3 | 2004 | 67 | 1 | ||
4 | 3 | 2006 | 89 | 2 |
Another very basic question - how do I create the first table?
And, each participant is identified by both a personal ID and a household ID.
Thank you!
"how do I create the first table?"
The "have" table? So you don't have your table already in SAS? In what format is your source data (excel, csv,...?). What SAS client are you using (SAS EG, SAS Studio?)
"And, each participant is identified by both a personal ID and a household ID."
The data you posted looks like a person is fully identified by "personal ID". "household ID" appears to be what it says: Grouping persons together into households.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.