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-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!

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.

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
  • 4 replies
  • 858 views
  • 0 likes
  • 3 in conversation