Re: Help - Displaying the max vaule from SAS data set
- From: Einar Andreas Rødland <e.a.rodland@xxxxxxxxxxxxxx>
- Date: Wed, 21 Jun 2006 10:06:17 +0200
Puneet wrote:
Hi,
I am a beginner and just started using SAS 9.1 two weeks ago.
I have SAS data set which contains numeric variables and now I want to
display the max value in that data set corresponding to some particular
variable.
The quick, easy and nice solution is using SQL. If X is a variable in a dataset DS,
proc sql;
select max(X) from DS;
quit;
will print the maximum in the output frame. To put the result into a new dataset instead:
proc sql;
create table DSMAX as
select max(X) as X_MAX
from DS;
quit;
A nice general advice: If it's tricky to do using data steps, try SQL; if it's tricky to do using SQL, try data steps.
Data steps consider data a sequential list of observation, SQL considers it an unordered set of observation. Thus, they tend to be good for different things.
Einar
.
- Follow-Ups:
- Re: Help - Displaying the max vaule from SAS data set
- From: John Uebersax
- Re: Help - Displaying the max vaule from SAS data set
- References:
- Help - Displaying the max vaule from SAS data set
- From: Puneet
- Help - Displaying the max vaule from SAS data set
- Prev by Date: Estimate ICC given Pearson r and means?
- Next by Date: Re: Help - Displaying the max vaule from SAS data set
- Previous by thread: Re: Help - Displaying the max vaule from SAS data set
- Next by thread: Re: Help - Displaying the max vaule from SAS data set
- Index(es):
Relevant Pages
|