SAS author's tip: Selecting a simple random sample

1

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

About Author

Shelly Goodin

Social Media Specialist, SAS Publications

Shelly Goodin is SAS Publications' social media marketer and the editor of "SAS Publishing News". She’s worked in the publishing industry for over thirteen years, including seven years at SAS, and enjoys creating opportunities for fans of SAS and JMP software to get to know SAS Publications' many offerings and authors.

Related Posts

Back to Top