BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I'm creating a stored process which will produce a report of employees chosen at random, based on selected percentages. However, I am not sure of how to do this in Ent. Guide! Would I use something like the following:

proc surveyselect data=HMASelect
n=25;
method=srs
out=HSW;
run;

However, I don't want to hard-code the n=25; above....I want to be able to process my entire table.

Also, in the same program, I need to select a certain percentage of administrators, a certain percentage of staff and a certain percentage of classified employees. In short.... say 25 % of admin, 50% of staff and the remainder to be 25%. Then, for example, in the 25% of admin, to randomly select admin, and so on.

If someone can please help, I would appreciate it. Thank you, and I look forward to your replies!
9 REPLIES 9
deleted_user
Not applicable
Anybody ??? I actually only need help with how to figure the percentage pieces. I've looked at the samples under SAS Tech Support and through Google, but do not understand the percentage derivations.

Plus, the books we have on site don't cover proc surveyselect....the books are too old.

So, anybody?? Please??
Cynthia_sas
SAS Super FREQ
Hi,
I was a Lit major and now I'm a report geek (and teacher). I don't use PROC SURVEYSELECT. Your best bet for help using PROC SURVEYSELECT is to contact Tech Support.
cynthia
advoss
Quartz | Level 8
"Plus, the books we have on site don't cover proc surveyselect....the books are too old."

Try
http://support.sas.com/onlinedoc/913/docMainpage.jsp
deleted_user
Not applicable
Thanks for the link....I'll check it out.
Olivier
Pyrite | Level 9
Try the SAMPRATE=0.25 instead of the N option.
This will draw you a sample which size is one fourth of the total dataset.

Regards,
Olivier
deleted_user
Not applicable
Oliver,

Thanks for replying, however, I need to process my whole dataset, as mentioned in my initial note:

"However, I don't want to hard-code the n=25; above....I want to be able to process my entire table.

Also, in the same program, I need to select a certain percentage of administrators, a certain percentage of staff and a certain percentage of classified employees. In short.... say 25 % of admin, 50% of staff and the remainder to be 25%. Then, for example, in the 25% of admin, to randomly select admin, and so on."

I do however appreciate your responding. If I misunderstand your reply, please accept my apology.
Cynthia_sas
SAS Super FREQ
Hi:
According to the SURVEYSELECT doc, you can
"....can perform stratified sampling, selecting samples independently within the specified strata, or nonoverlapping subgroups of the survey population. "

If reading the documentation doesn't help, then you may want to search for papers about PROC SURVEYSELECT. Or, if your data are not survey-based, you may wish to investigate other techniques to randomly select observations. Tech Support can help you figure out the best technique to use.

To send a question to Tech Support, go to http://support.sas.com/ and in the left-hand navigation pane, click on the link entitled "Submit a Problem".
cynthia
Olivier
Pyrite | Level 9
Hi SASMan.

It's just me being stupid : I misread your problem. Now that you explain (twice), I think I understand.
You can use the SAMPRATE option pointing on a dataset containing the percentage (in a variable that MUST be named _RATE_) of each subgroup you want to draw samples from.
In your exemple, that would lead to :
[pre]
PROC SORT DATA = yourData OUT = work.categories NODUPKEY ;
BY status ;
RUN ;
DATA work.categories ;
SET work.categories (KEEP = status) ;
IF status = "Admin" THEN _rate_ = .25 ;
ELSE _rate_ = .50 ;
RUN ;
PROC SURVEYSELECT DATA = yourData OUT = yourSelection
METHOD = SRS NOPRINT
SAMPRATE = work.categories ;
STRATA status ; /* your dataset must be sorted by STATUS */
RUN ;
[/pre]

I hope that this time I am delivering interesting information. If not, please feel free to ask again -- in the end I may understand something 🙂
Cheers,
Olivier
deleted_user
Not applicable
Olivier,

Actually, that looks quite like what I'm thinking of! I'lltake a crack at modifying your code suggestion and see what comes out the other end.

Thank you very much! I'll let you know.....

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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