BookmarkSubscribeRSS Feed
bbenbaruch
Quartz | Level 8

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_ ;
DATALINES ;
HAND,1,0.10
HAND,2,0.07
HAND,3,0.07
HAND,4,0.05
HAND,5,0.10
HAND,6,0.0
HAND,7,0.07
HAND,8,0.0
HAND,9,0.05
HAND,10,0.07
HAND,11,0.05
HAND,12,0.05
HAND,13,0.10
HAND,14,0.10
HAND,15,0.07
HAND,16,0.05
;
RUN ;

2 REPLIES 2
PGStats
Opal | Level 21

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;
PG
bbenbaruch
Quartz | Level 8

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."

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 733 views
  • 1 like
  • 2 in conversation