LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (May 2012, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 15 May 2012 08:56:30 -0700
Reply-To:     mlhoward@avalon.net
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Mary <mlhoward@AVALON.NET>
Subject:      Re: SAS random record selection
Comments: To: Kathleen Askland <k.askland@GMAIL.COM>
Content-Type: text/plain; charset="UTF-8"

No, I don't; we actually write our own sampling code rather than using surveyselect to meet the client specificiation more carefully.

But I would think you could put this in a macro, such as:

%macro sample;

proc surveyselect...

proc sql...

%mend

As to the 1000 conditions; I'm not sure what they look like, but I've done things like that where I loaded all the conditions into a data step and then popped them off, such as:

data conditions; informat condition $500.; condition='where .... '; output; condition='where .... '; output; run;

data conditions; set conditions; runnum + 1; run;

%macro sample;

%do i=1 %to 1000; proc sql noprint; select condition into :condition where runnum=&i; quit;

proc surveyselect; ... &condition; run;

proc sql...

%mend;

Good luck!

-Mary

--- k.askland@GMAIL.COM wrote:

From: Kathleen Askland <k.askland@GMAIL.COM> To: SAS-L@LISTSERV.UGA.EDU Subject: SAS random record selection Date: Tue, 15 May 2012 11:22:57 -0400

Thank you very much, Mary. Your code worked, however, I should have been more explicit. I will actually need to generate 1000 random replicates from the dataset. This would make the sql code very cumbersome, I suspect, since I'd then need to list 1000 conditions in the set statement of the final proc sql step. Do you know of any way of running the random selection and creating indicator variables within an existing dataset? Thanks again for your help. Kathleen


Back to: Top of message | Previous page | Main SAS-L page