Example 9.9 Selecting Observations at Random from a Data Set without Replacement

Goal

Create a subset of a data set by randomly choosing observations from the data set. Do not allow an observation to be selected more than once. This method is commonly referred to as simple random sampling without replacement.

Examples 9.9 and 9.10 show different methods of sampling observations from data sets.

Example Features

Featured StepPROC SURVEYSELECT
Featured Step Options and StatementsPROC SURVEYSELECT statement options: METHOD=SRS, OUT=, SAMPSIZE=, SEED= options
Related Technique 1DATA step with RANUNI function and PROC SORT
Related Technique 2DATA step with RANUNI function, OUTPUT and STOP statements, SET statement with NOBS= option

Input Data Set ...

Get Combining and Modifying SAS® Data Sets: Examples Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.