College of Natural Sciences
 
FAQs
This is for IE7 to hold div open

SAS FAQ #17: Selection of a random subset of data in SAS

Question:

How do I randomly sample a certain proportion of observations from a SAS dataset?

Answer:

In the DATA step, include the line:

IF RANUNI(0)<=.1 ;

This statement will randomly select approximately 10% of the observations from the original data. To change this proportion, change .1 to any value between 0 and 1. The value you specify will determine (approximately) the proportion of the original dataset that will be selected for inclusion in the current dataset.

For more information, click on the Help button in the SAS menu bar and scroll to SAS Help and Documentation.

If you have further questions, send E-mail to stats@ssc.utexas.edu.