02-28-2016 05:33 PM
I have been searching for a way to pass the sample size to proc surveyselect when the sample is not strata. the "n" or sampsize only takes integers in the proc surveyselect. I looked to pass the sample size using proc sql outobs= .... but outobs only takes integers also. The sample size is calculated and is called samplesize
proc surveyselect data=datain sampsize=samplesize out=dataout;
I even thought to use a do loop and pass the sample size to the do loop. I have not found a way. How do we pass the sample size to any proc or is there another way to do this?
02-28-2016 05:35 PM
I'm confused. A record is whole, so only integers make sense in the list.
What exactly are you trying to do? Why not round your values in the calculation?
Sampsize also takes a dataset so you can specify it in that manner, or if a single number a macro variable. But the restriction on whole numbers makes sense.
02-28-2016 06:11 PM
I want to select 10% of my observations and pass that number to proc surveyselect to limit the # of observations. the question marks below in the snippet of code are were I want to place a variable so the "n" or "sampsize" is equal to the value in the variable. In this case that variable is called nsize. The same problem is presented when using proc sql outobs=????. By design it appears i can only place an integer. So "how?" without hard coding in the integer can I pass a value to a variable to get different sample sizes?
infile '/folders/myfolders/datain.txt' dlm='09'X end=eof;
input gender age systolic diastolic;
count + 1;
if eof=1 then
do nsize=round(count * .10);
call symput ("samplesize", nsize);
proc surveyselect data=datain n=???? out=dataout;
proc surveyselect data=datain sampsize=????? seed=-1 out=dataout;
02-28-2016 07:46 PM
Need further help from the community? Please ask a new question.