Hello everyone. I have a dataset that has has a variable I would like to do a random sample with replacement from. The trick is, the dataset has a grouping variable State. I would like to do a random sample of 10,000 observations on the same variable for EACH state, so that at the end of the day my dataset would have 10,000 * 50 or 500,000 observations. I don't think surveyselect can do this but if I am incorrect please let me know. I found this code for doing Random sample with replacement, but all of my attempts to get it to run "by groups" fails. Random Sample with Replacement code... Want to repeat it by groups. DATA SRS_WR/ ; SEED=123466; SamplingProbability=&SAMPLE_SIZE/FRAME_SIZE; SamplingWeight=1/SamplingProbability; DO samp_cnt=1 TO &sample_size; SELECT=CEIL( UNIFORM(SEED) * FRAME_SIZE ); SET ResidualsDists POINT=SELECT NOBS=FRAME_SIZE; output; end; stop; run; I could also put this into a macro loop and repeat the code that way, however that seems very inefficient and I imagine there is a way to get it to work using "by groups". If anyone can provide help it would be greatly appreciated. Here is an example of my data (very small example).Value data MetricLocation; infile datalines delimiter=','; input State $ MEtricDist; datalines; CA,506 CA,45 CA,41 CA,32 CA,49 CA,45 CA,38 CA,20 CA,61 CA,64 CA,305 CA,42 CO,506 CO,46 CO,42 CO,33 CO,50 CO,51 CO,62 CO,60 CO,55 CO,49 CO,53 CO,51 ;
... View more