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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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