Hello The simple random code with replacement usually produce output with hits number, for instant id 22 is chosen three times. However I do not want the output like that , I want all the three hit live in the second output. That I want the sample size to stay 10, even if it is not independent like in output two below.
proc surveyselect data = hsb25 method = SRS rep = 1
sampsize = 10 seed = 12345 out = hsbs1;
id _all_;
run;
proc print data = hsbs1 noobs;
run;
proc surveyselect data=hsb25 method = urs sampsize = 10
rep=1 seed=12345 out=hsbs2 out=outhits;
id id read write math science socst;
run;
proc print data = hsbs2 noobs;
run;
OUTPUT ONE
Rep id re wri math sc soc Hits
1 108 34 33 41 36 36 1
1 50 50 59 42 53 61 1
1 102 52 41 51 53 56 1
1 136 65 59 70 63 51 1
1 171 60 54 60 55 66 1
1 22 42 39 39 56 46 3
1 47 47 46 49 33 41 1
1 56 55 45 46 58 51 1
Hello The code above gives the output of Simple random sampling with replacement. The sample size is 10. However I am not happy with the way the data is reported. I want the Hits= 3 to be reported three times. I wish to ask if any knows how to help me report the data like this:
OUTPUT TWO
Rep id re wri math sc soc Hits
1 108 34 33 41 36 36 1
1 50 50 59 42 53 61 1
1 102 52 41 51 53 56 1
1 136 65 59 70 63 51 1
1 171 60 54 60 55 66 1
1 22 42 39 39 56 46 1
1 22 42 39 39 56 46 1
1 22 42 39 39 56 46 1
1 47 47 46 49 33 41 1
1 56 55 45 46 58 51 1
Add option OUTHITS to the Proc Surveyselect statement. - PG
Thanks PGStats
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: