Hello all,
I have a long formatted file, in which every subject has more than one row. For each row, I have several variables, two of them are "ID" and "Visit". Each subject has 5 visits. I have 50 subjects.
I want to make a random sampling with replacement, in order to get a larger file, with 100 subjects.
The problem is, when I use PROC SURVEYSELECT (which is straightforward), SAS chooses rows, not subjects. I want SAS to sample a subject, and to keep all his rows, rather than randomly selecting rows.
Can it be done ? I am pretty much lost here.
Thank you.
SAMPLINGUNIT | CLUSTER variables < / options > ;
Have you already tried to use proc transpose to reformat the file into rows?
I have an idea. Can I save the number of times each subject is selected, and then build different datsets for subjects with number of hits of up to 1, up to 2, etc... and then append these datasets ?
SAMPLINGUNIT | CLUSTER variables < / options > ;
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.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.