proc surveyselect or the easy way to select samples
DESCRIPTION
Proc Surveyselect or the easy way to select samples. Gitte Churlish Churlish Consulting. Sample selection (SAS 6). * to select 15 in a random fashion; Data temp; Set trees; select = ranuni (5432); run; Proc sort data = temp; by select; Data sample; set temp (obs = 15); run;. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Proc Surveyselect or the easy way to select samples](https://reader036.vdocument.in/reader036/viewer/2022082611/56812b6a550346895d8f8d64/html5/thumbnails/1.jpg)
Proc Surveyselect or the easy way to select samples
Gitte Churlish
Churlish Consulting
![Page 2: Proc Surveyselect or the easy way to select samples](https://reader036.vdocument.in/reader036/viewer/2022082611/56812b6a550346895d8f8d64/html5/thumbnails/2.jpg)
Sample selection (SAS 6)
* to select 15 in a random fashion;
Data temp; Set trees; select = ranuni (5432); run;
Proc sort data = temp; by select;
Data sample; set temp (obs = 15); run;
![Page 3: Proc Surveyselect or the easy way to select samples](https://reader036.vdocument.in/reader036/viewer/2022082611/56812b6a550346895d8f8d64/html5/thumbnails/3.jpg)
Proc Surveyselect
Proc surveyselect data = trees
Method = SRS n = 15 out = sample1;
run;
– Selects 15 samples from the population.– Sample1 – contains 15 records with sampling
weights
![Page 4: Proc Surveyselect or the easy way to select samples](https://reader036.vdocument.in/reader036/viewer/2022082611/56812b6a550346895d8f8d64/html5/thumbnails/4.jpg)
Methods
Simple random sample Unrestricted random sample Systematic random sample Sequential random sample PPS Sampling (7 methods)
![Page 5: Proc Surveyselect or the easy way to select samples](https://reader036.vdocument.in/reader036/viewer/2022082611/56812b6a550346895d8f8d64/html5/thumbnails/5.jpg)
Use of strata
Proc surveyselect data = trees
Method = SRS n = 15 out = sample1;
strata lv_d;
run; - select 15 trees from live, and 15 trees from
the dead strata
![Page 6: Proc Surveyselect or the easy way to select samples](https://reader036.vdocument.in/reader036/viewer/2022082611/56812b6a550346895d8f8d64/html5/thumbnails/6.jpg)
Sample size
Proc surveyselect data = treesMethod = SRS out = sample1;strata lv_d;Sampsize = 5,15;run; select 5 trees from the dead strata and 15
trees from live File must be sorted by strata variables
![Page 7: Proc Surveyselect or the easy way to select samples](https://reader036.vdocument.in/reader036/viewer/2022082611/56812b6a550346895d8f8d64/html5/thumbnails/7.jpg)
Use of file for sample size
proc surveyselect data=samp1
(where = (lv_d = 'L'))
out=select_live
method=sys
seed = 5763
sampsize = no_to_select_live;
strata age_grp spp_grp;
Note use of SEED – provides repeatability
![Page 8: Proc Surveyselect or the easy way to select samples](https://reader036.vdocument.in/reader036/viewer/2022082611/56812b6a550346895d8f8d64/html5/thumbnails/8.jpg)
Creation of sampsize file
data no_to_select_live (keep = spp_grp age_grp _nsize_); set spp_grp_count_live; if age_grp = 'Mat' then do ; if spp_grp = 'BCHD-dec' then _nsize_ = 1; if spp_grp = 'BCHD-BL' then _nsize_ = 10; if spp_grp = 'BCHD-C' then _nsize_ = 1; if spp_grp = 'BCHD-HW' then _nsize_ = 3; if spp_grp = 'FPSL-FD-P' then _nsize_ = 11;
if spp_grp = 'FPSL-LW' then _nsize_ = 3; if spp_grp = 'FPSL-S' then _nsize_ = 5;
end ; if _nsize_ = 0 or _nsize_ = . then _nsize_ = 1; /* can't have a zero */ if _nsize_ > count then _nsize_ = count ; run;
![Page 9: Proc Surveyselect or the easy way to select samples](https://reader036.vdocument.in/reader036/viewer/2022082611/56812b6a550346895d8f8d64/html5/thumbnails/9.jpg)
PPSWR sampling
Great for sampling in GIS files
Method = pps_wr
probability proportional to size and with replacement.
![Page 10: Proc Surveyselect or the easy way to select samples](https://reader036.vdocument.in/reader036/viewer/2022082611/56812b6a550346895d8f8d64/html5/thumbnails/10.jpg)
PPS_WR example
proc surveyselect data = GIS_polygon_file out = &file_out method = pps_wr
outhits seed = &seedsampsize = samp_rate (rename = (max =_nsize_)); size polyarea; strata spec_cl vol_cls; run;
NOTE: Size has been added, This indicates the variable to use for proportionality.
![Page 11: Proc Surveyselect or the easy way to select samples](https://reader036.vdocument.in/reader036/viewer/2022082611/56812b6a550346895d8f8d64/html5/thumbnails/11.jpg)
Related Procs
Proc Surveyfreq Proc surveymeans Proc surveyreg Proc surveylogistic
Take into account sampling weights