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 (March 2000, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 21 Mar 2000 17:37:35 +0100
Reply-To:     detecsm_hellriegelg@WESTLB.DE
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Gehard Hellriegel <detecsm_hellriegelg@WESTLB.DE>
Subject:      Re: Help with random assignment of values.
Content-type: text/plain; charset=us-ascii

Quick and dirty, something like that: data test; array a(*) $2 a1-a6; a1="EB"; a2="ES"; a3="EG"; a4="CB"; a5="CS"; a6="CG"; do i=1 to 100000; index=mod(floor(ranuni(9)*10),6)+1; value=a[index]; output; end; run;

"Walker, Richard M" <Richard.M.Walker@BRITISHAIRWAYS.COM> on 21.03.2000 16:57:52

Bitte antworten an "Walker, Richard M" <Richard.M.Walker@BRITISHAIRWAYS.COM>

An: SAS-L@LISTSERV.UGA.EDU Kopie: (Blindkopie: DeTeCSM HellriegelG/D/ExternalStaff/WLB) Thema: Help with random assignment of values.

SAS-Lers

I have a requirement to generate a SAS dataset for testing an update process.

I am looking to generate a data step that will create say, 100,000 records with a variable containing a random number and a number of variables containing a value that is randomly selected from a small group

CID LTYPRCD

random number 'EB','ES','EG','CB','CS','CG'

I can manage the generation of the random CID but I'm not sure how to randomly select a value for the LTYPRCD from the group indicated above.

Any guidance would be appreciated.

Regards Richard

Mit freundlichen Gruessen

DeTeCSM, Gerhard Hellriegel

WestLB Abteilung: 001-80622 Aderstr. 22 D - 40217 Duesseldorf Tel.: +49211 826 6173 Fax: +49211 826 5393


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