BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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!
2 REPLIES 2
RickM
Fluorite | Level 6
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
Patrick
Opal | Level 21
In case you've got SAS\STAT: PROC SURVEYSELECT could do the job as well.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 663 views
  • 0 likes
  • 3 in conversation