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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.