Hello,
I have data with 156 variables and 10000 observations. Values of one variable are from 2 to 16 (only even) and I need to select 4 randomly selected values from this variable and keep them in data. I tried to use surveyselect procedure, but it doesn't work. I also thought about using ranuni, but don't know how to create even number:(
Thanks
Here is an example of selecting 4 age groups from sashelp.class with proc surveyselect:
proc sort data=sashelp.class out=class; by age; run;
proc surveyselect data=class out=ageSample sampsize=4;
cluster age;
run;
Clarification is requested. When you say:
I need to select 4 randomly selected values
do you really mean "select 4 randomly selected observations"?
Can you give us an example using, say, a data set with 20 observations, and the desired output?
Here is the example data. I want ot select these observations with for example a=2 or 4 or 6 or 8, the I don't know the value and I want to get the random one from available.
and desired output in my example with a=2,4,6,8 would be observations 1,2,3,4,5,6,7,8,9,10,12,13,16.
Here is an example of selecting 4 age groups from sashelp.class with proc surveyselect:
proc sort data=sashelp.class out=class; by age; run;
proc surveyselect data=class out=ageSample sampsize=4;
cluster age;
run;
That is what I meant, thanks a lot! 😄
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.