'Sampling with parameters in SAS

I have a large dataset dataset with 20 columns, and the columns "ltv", that contains the classification high, low and medium and "ticket" that contains values. I need 500 samples from dataset with "ltv" 70% low, 20% medium, 10% low and "ticket" between 252.00 and 300.00. How can I get this in SAS?



Solution 1:[1]

You would use PROC SURVEYSELECT with stratification on the ltv variable. You can specify the differing sampling rate with the samprate option.

Example:

proc surveyselect data = have out = want method = srs 
                  samprate = (.7 .2 .1) seed = 9876;
where ticket between 252 and 300;
strata ltv;
run;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Reeza