Help using Base SAS procedures

Generating a pseudo random data set from existing data

Reply
N/A
Posts: 0

Generating a pseudo random data set from existing data

Hello,

I want to create a pseudo random data set from existing data. Basically, I have a primary data set (call it Alpha) and I want to generate a new dataset (Beta) with a random selection of lines from Alpha. The logic of the process is something like this:

1. Open Alpha.
2. Generate a random number variable in Alpha.
3. Select one line of data (row) from Alpha based on the random numbers.
4. Append this random line of data to Beta.
5. Repeat 1-4 in a loop for X repetitions to create Beta with X lines. (Random draw with possibility of repeated draws)

Is there a quick way to write a macro or proc sql to do this?

Thanks!
Regular Contributor
Posts: 165

Re: Generating a pseudo random data set from existing data

I knew this was covered in the Advanced Certification Prep Guide and after a small amount of searching I found this site that shows (and explains) the code.

http://www.stat.psu.edu/online/program/stat482/11random/03random_sampling_with.html
Respected Advisor
Posts: 3,900

Re: Generating a pseudo random data set from existing data

In case you've got SAS\STAT: PROC SURVEYSELECT could do the job as well.
Ask a Question
Discussion stats
  • 2 replies
  • 119 views
  • 0 likes
  • 3 in conversation