/***************************************************************************************************************** SAS file name: random_sampling_witt.sas File location: __________________________________________________________________________________________________________________ Purpose: To demonstrate how to do random sampling with replacement in SAS with the Data Step and PROC SURVEYSELECT Author: Peter Clemmensen Creation Date: 16/01/2020 This program supports the blog post "Random Sampling in SAS With Replacement" on SASnrd.com *****************************************************************************************************************/ /* Example data */ data have; input id x; datalines; 1 1 1 2 1 3 2 4 2 5 2 6 2 7 3 8 3 9 3 10 3 11 3 12 ; /* Data step */ data want; do _n_ = 1 to 5; p = rand ("integer", n); set sashelp.class point = p nobs =n; output; end; stop; run; /* PROC SURVEYSELECT */ proc surveyselect data=have out=want(drop=Numberhits) noprint method=urs outhits sampsize=5; run;