Date: Wed, 30 Aug 2006 15:04:16 -0700
Reply-To: Cat <job.alerte@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Cat <job.alerte@GMAIL.COM>
Organization: http://groups.google.com
Subject: Re: alternative ways to get Min and Max?
In-Reply-To: <200608292034.k7TITt8o014304@mailgw.cc.uga.edu>
Content-Type: text/plain; charset="iso-8859-1"
Hi Jerry,
I suggest:
proc sql noprint;
select min(num), max(num)
into :start, :end
from minmax;
quit;
Regards,
Catherine.
Jerry wrote:
> Hi,
>
>
> I use PROC MEANS to get Min and Max of the value of a numerical variable,
> see codes below.
>
> Data minmax;
> input num;
> datalines;
> 1
> 2
> 3
> ;
> run;
>
> Proc means data=minmax noprint;
> var num;
> output out=range max=last min=first;
> run;
>
> Then I use CALL SYMPUTX to assign the min & max value to 2 macro variables,
> see codes below,
>
> Data _null_;
> set range;
> if _n_=1 then do;
> call symputx ("start", first);
> call symputx ("end", last);
> stop;
> end;
> run;
>
>
> Is there any other way (excluding Proc Sql) to skip Proc Means while
> achieving the same goal: assign the min & max value to 2 macro variables ?
>
> Thanks,
>
> Jerry
|