BookmarkSubscribeRSS Feed
Gustavo8
Calcite | Level 5

Hi all :

 

Thanks for helps in this SAS community.

 

I have one more question that:

 

I used proc survey function to select some data from the data set, but I wan to change the rest of this dataset's variable to 9999 (which is a dummy number) and merge them back to one data set.

 

I tried to use the SQL function, but it doesn't work because the first survey dataset includes other output variables.

 

Here is the code and the dataset:

 

proc surveyselect data=ORD;

method=pps sampsize=125 out = randomsurvey_PPS ;

size b ;

run;

 

Thanks for your help!(I want to select the rest of 875 numbers as a new dataset and change the b =9999)

 

4 REPLIES 4
ballardw
Super User

Your example code won't run as shown. The semicolon after the input data set name will cause problems as the method, sampsize and out parameters are part of the Proc statement.

 

I thing that you want the OUTALL option on the Proc statement. Then all of the records of the input set are in the output with a variable, Selected, that indicates which records are the selected records with a value of 1 and 0 when not selected.

 

Then use a data step to set the variables as needed when Selected=0.

Watts
SAS Employee

The OUTALL option isn't currently available with METHOD=PPS. (It's available with equal-probability selection methods.)

 

The approach in this post by @PeterClemmensen might do what you need.  

PeterClemmensen
Tourmaline | Level 20

@Watts, boy do I wish I was the guy that wrote that answer. However, all the credit must go to @FreelanceReinh 🙂

Watts
SAS Employee

Thanks for the correction. And thanks to @FreelanceReinh Smiley Happy

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 699 views
  • 2 likes
  • 4 in conversation