BookmarkSubscribeRSS Feed
Elliott
Obsidian | Level 7

is there any option for surveyselect to create an empty dataset when there are no records in the dataset it is selecting from does not have any records?

 

If not, is there another option to random sampling what will produce a output dataset with no records.

 

Thanks,

Elliott

4 REPLIES 4
PGStats
Opal | Level 21

What kind of sampling are you trying to do? Please post your surveyselect code.

PG
ballardw
Super User

@Elliott wrote:

is there any option for surveyselect to create an empty dataset when there are no records in the dataset it is selecting from does not have any records?

 

If not, is there another option to random sampling what will produce a output dataset with no records.

 

Thanks,

Elliott


What do you expect to be in the output set after "randomly " selecting nothing from nothing?

 

If you want to create data set with the same structure but no records then

data junk;
   set sashelp.class (obs=0);
run;

Surveyselect given a zero record input set will generate an output set with zero records and zero variables. Not very useful as far as I can see.

 

Elliott
Obsidian | Level 7
I know it makes no sense. I an just trying not to have the code error in a production environment. Sometimes there are no records that meet the criteria to sample from. I just need a blank data set in that case to produce a empty sheet in the reporting I am providing.
ballardw
Super User

@Elliott wrote:
I know it makes no sense. I an just trying not to have the code error in a production environment. Sometimes there are no records that meet the criteria to sample from. I just need a blank data set in that case to produce a empty sheet in the reporting I am providing.

Are you wanting the Surveyselect tables with the selection method and summary of input/output sets with weights or something else?

What exact type of selection are you doing? Does your current empty input set generate errors?

 

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1216 views
  • 0 likes
  • 3 in conversation