BookmarkSubscribeRSS Feed
Blandine
Obsidian | Level 7

I am doing a stratified random selection of 385 bridge based on 2 strata STRUCTURE_KIND_043A OWNER_022 and my data have STRUCTURE_NUMBER_008,STRUCTURE_KIND_043A, OWNER_022. the goal is to select a proportionate sample bridge based on the strata and I want to have the bridge number so I can make an analysis later on. however, with my code, I lost the bridge number somehow and I do not see the 385 bridge samples I was looking for. How do I retrieve it or is there a better way to do the stratified random selection with 2 different sample sizes of the strata?

 

here is my code

proc sort data=SUP.IDNBI_PSC_FILESTEST
out=SUP.IDNBI_PSCsort;
by STRUCTURE_KIND_043A OWNER_022; 
run;

proc surveyselect data=SUP.IDNBI_PSCsort n=385
out=SUP.IDNBI_PSCsamp; 
strata STRUCTURE_KIND_043A OWNER_022/ alloc=prop nosample;
run;

 

 

here is the result

Blandine_0-1605212446990.png

 

5 REPLIES 5
ballardw
Super User

Check to make sure the variable is in the input data set.

If you do not include an ID statement to request specific variables then the procedure will have all variables from the input set in the output.

Blandine
Obsidian | Level 7

I just did and all the input variable are there

Blandine_0-1605213279885.png

 

Blandine
Obsidian | Level 7

My output is still the same not sure why I am getting this issue.

any idea?

ballardw
Super User

Try adding an ID statement with the names of any variables that you do want in the output.

Watts
SAS Employee

It looks like your code specifies the NOSAMPLE option in the STRATA statement. This option computes the allocation of the total sample size (among the strata) but doesn't select the sample. Your result is an allocation output data set, which provides the sample sizes for the strata. (The levels of your 2 STRATA variables form 19 strata.)

 

If you want to select the sample, you can just remove the NOSAMPLE option from the STRATA statement.  

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!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 755 views
  • 0 likes
  • 3 in conversation