Date: Fri, 15 Jun 2007 11:29:28 -0400
Reply-To: "data _null_;" <datanull@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "data _null_;" <datanull@GMAIL.COM>
Subject: Re: Randomly picking a procedurecode for each doctor
In-Reply-To: <200706151518.l5FF1YFH032107@mailgw.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
I think, you want to use STRATA DOCID and N=1. If I understand correctly.
data work.docs;
input docid:$6. procedurecode:$5. @@;
cards;
001111 21740 001111 21740 001111 21740 001111 21740 001111 21740
001111 20680 001111 20680 001112 50240 001112 50240 001112 50240
001112 52601 001112 52601 001112 55845 001113 48140 001113 48140
001113 48140 001113 48140 001113 48140 001113 48150 001113 48150
001113 47130 001113 47135 001114 53500 001114 53500 001114 53500
001114 53450 001114 53450 001115 21045 001115 21045 001115 21045
001115 21040 001115 21040
;;;;
run;
proc surveyselect
seed=20062001
data=docs
method=SRS
n=1
out=surgerycase1;
strata docid;
run;
proc print;
run;
On 6/15/07, Annie Lee <hummingbird10111@hotmail.com> wrote:
> Hi,
>
> I have a data set with doctor's id (multiple records for each doctor) and
> procedurecode.
>
> This time, I would like to pick one randomly selected procedurecode for
> each (unique) doctorid in order to avoid any bias in selecting
> procedurecode.
>
> I tried doing this using proc surveyselect.
> one question I have regarding using proc surveyselect-- is there a way not
> to specify the sampsize in advance?
> In the future, I will have different number of records every quarter in
> this data set and I do not want to calculate the unique number of docid
> beforehand to assign the sampsize manually.
>
> I would appreciate any help. Thank you. -Eunice
>
>
>
> proc surveyselect data = surgerycase method = SRS rep = 1
> sampsize = ?? out = surgerycase1;
> id _all_;
> run;
>
>
>
> Results I would like to have:
>
> docid procedurecode (it is randomly picked so it could be any
> procedurecode)
>
> 001111 21740
> 001112 50240
> 001113 48140
> 001114 53500
> 001115 21045
>
> data set:
>
> docid procedurecode
>
> 001111 21740
> 001111 21740
> 001111 21740
> 001111 21740
> 001111 21740
> 001111 20680
> 001111 20680
> 001112 50240
> 001112 50240
> 001112 50240
> 001112 52601
> 001112 52601
> 001112 55845
> 001113 48140
> 001113 48140
> 001113 48140
> 001113 48140
> 001113 48140
> 001113 48150
> 001113 48150
> 001113 47130
> 001113 47135
> 001114 53500
> 001114 53500
> 001114 53500
> 001114 53450
> 001114 53450
> 001115 21045
> 001115 21045
> 001115 21045
> 001115 21040
> 001115 21040
>
|