This week's SAS tip is from A. John Bailer and his book Statistical Programming in SASA Fellow of the American Statistical Association, John has been using SAS for 30 years. His expertise clearly comes through in his book.

The following excerpt is from SAS Press author John Bailer and his book "Statistical Programming in SAS" Copyright © 2010, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED. (please note that results may vary depending on your version of SAS software).

3.11 Selecting a Simple Random Sample

Simple random samples can be selected using survey procedures. Suppose you want to select a sample of N=6 cities (without replacement) from the SMSA data set (which contains N=60 cities). The SURVEYSELECT procedure makes this a simple task. The program is shown in Display 3.32.

A data set containing the sample frame—a list of all population elements—is passed to PROC SURVEYSELECT as data=SMSA_from_txt. A simple random sample of a specified sample size is specified in method=srs n=6 with the resulting sample stored in the SAS data set specified by out=sample_SMSA_cities. The sample is printed in Display 3.33.

The SURVEYSELECT procedure can generate bootstrap samples. Cassell (2007) has a nice discussion of using PROC SURVEYSELECT in this way. In his discussion, the sampling with replacement uses the METHOD=URS option with PROC SURVEYSELECT and SAMPRATE=1 to implicitly define the bootstrap sample size to equal the original sample size. In Chapter 8, a percentile bootstrap is implemented using DATA step programming.

To read a free chapter and user reviews of John's book, visit his author page. You can also view three previously featured excerpts from Statistical Programming in SAS on this blog: Using PROC PRINT to list observations in a data set, PROC MEANS for descriptive statistics, and Destination--RTF, HTML, PDF, and more.

Share