Date: Thu, 26 Jul 2007 17:38:40 -0000
Reply-To: webonomic <webonomic@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: webonomic <webonomic@GMAIL.COM>
Organization: http://groups.google.com
Subject: Re: Generate observations with a specific range of randomly
In-Reply-To: <BAY123-F21DB49047B260069140A09DEF20@phx.gbl>
Content-Type: text/plain; charset="us-ascii"
Awesome, I like it!
This is especially helpful when I have a set of non-consecutive
numbers or want to use string arrays.
Thanks!
On Jul 26, 10:54 am, tobyd...@HOTMAIL.COM (toby dunn) wrote:
> I like large seeds and I also like the code to specify what the values are
> to randomly select:
>
> Data Need ( Keep = X Y Z ) ;
> Array TempA ( 4 ) ( 1 , 2 , 3 , 4 ) ;
> Array TempB ( 2 ) ( 0 , 1 ) ;
> Array TempC ( 3 ) ( 1 , 2 , 3 ) ;
> Array TempD ( 3 ) ( 4 , 5 , 6 ) ;
>
> Seed = 1234567890123 ;
>
> Do I = 1 To 20 ;
>
> Call RanPerm( Seed , Of TempA: ) ;
> X = TempA( 1 ) ;
>
> Call RanPerm( Seed , Of TempB: ) ;
> Y = TempB( 1 ) ;
>
> If Y = 0 Then Do ;
> Call RanPerm( Seed , Of TempC: ) ;
> Z = TempC( 1 ) ;
> End ;
> Else Do ;
> Call RanPerm( Seed , Of TempD: ) ;
> Z = TempD( 1 ) ;
> End ;
>
> Output ;
>
> End ;
>
> Run ;
>
> Toby Dunn
>
|