|
...what I'd suggest is only, to avoid a proc means for that. Sometimes you
have any preceeding data-steps with your data. You can instert something
like the following there:
...
retain max -9e9;
....
if x>max then do;
max=x;
call symput("maxx",max);
end;
...
Even if you don't have a data-step, replace the proc means with a
data _null_;
set ...;
retain ...
if max
...
run;
That would also work on very big datasets and much faster with less overhead!
On Fri, 1 Apr 2005 14:29:39 -0400, Elmaache, Hamani
<Hamani.Elmaache1@CCRA-ADRC.GC.CA> wrote:
>Hi.
>If my understanding is right,
>you could use the next code:
>
>data test;
>input x ;
>datalines;
>1
>2
>3
>4
>5
>10
>;
>
>proc means data=test;
>var x;
>output out=testa max=maxx;
>run;
>data _NULL_;
>set testa;
>call symput('maxx', maxx );
>run;
>
>data testaa;
>set test;
>y=x/&maxx;
>proc print;
>run;
>
>Good luck.
>
>
>-----Original Message-----
>From: Anthony Beckman [mailto:anthony_beckman@URMC.ROCHESTER.EDU]
>Sent: April 1, 2005 1:15 PM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: Proc Means output
>
>
>Hello listers
>
>Any easy one:
>
>Ihave a variable x of which I want to find the max value.
>I do so
>
>proc means data=test;
>var x;
>output out=testa max=maxx;
>run;
>
>Now I want to re-intergrate that max value into the original dataset so that
>I can divide all of the original values by it to get a percent of this max
>value.
>
>original/maxx=percent of max.
>
>however when I merege or set, I only get the first observation with the max
>
>x maxx
>1 10
>2 .
>3 .
>4 .
>5 .
>10 .
>
>what I want is
>
>x maxx
>1 10
>2 10
>3 10
>4 10
>5 10
>10 10
>
>Thanks all
|