05-08-2018 09:25 PM
NOTE that if Sample design file contains 0 for sampling rate of cells 6 and 8 these cells will not be in the output dataset.
I see 2 options:
1. Reset variable values, like I did for Spring segmentation but for ALL relevant sampling vars, in a separate data step.
2. Rejoin these records into the final file in a separate data step.
MY QUESTION IS: Is there a 3rd option? Is there a way to indicate that I am NOT sampling from cells 6 and 8 and yet want all records from cells 6 and 8 to be included in the ouput dataset?
[I am using EG 7.1x connecting to an AIX 64 unix server with SAS 9.4 installed and SAS STAT v.??? (installed at same time as SAS 9.4)]
DATA SMPLDESIGN_&SSN.&SFY._&RD0 ;
INFILE DATALINES DELIMITER="," ;
INPUT BRAND $4. CELL _RATE_ ;
05-09-2018 01:16 AM
You could always use a trick like this:
proc sort data=sashelp.class out=class; by age; run; data ss; input age _rate_; datalines; 11 50 12 50 13 50 14 0.00001 15 50 16 0.00001 ; proc surveyselect data=class samprate=ss out=temp outall outsize; strata age; run; data sample; set temp; if SamplingRate < 0.0001 then Selected = 0; run; proc print; run;
05-09-2018 12:22 PM
This may in fact be a good "work-around" solution,
I would think that the "better" "work-around solution" would be to allow for the exclusion of strata with no sample selected in the PROC SURVEYSELECT output dataset and then merge these records back in. Just as many steps -- but no danger of misleading values for sample-weights and selection probabilities in the final dataset.
However, I was hoping for a "real" solution that requires neither "gerrymandering" the data with an additional data step or having to merge unsampled strata back in. I guess maybe I will just have to go away singing "You can't always get what you want."