- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 11-26-2007 11:21 AM
(5734 views)
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!
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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??
Plus, the books we have on site don't cover proc surveyselect....the books are too old.
So, anybody?? Please??
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
"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
Try
http://support.sas.com/onlinedoc/913/docMainpage.jsp
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the link....I'll check it out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
This will draw you a sample which size is one fourth of the total dataset.
Regards,
Olivier
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.....
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.....