| Date: | Sun, 1 Aug 2010 06:28:14 -0700 |
| Reply-To: | Arthur Tabachneck <art297@NETSCAPE.NET> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Arthur Tabachneck <art297@NETSCAPE.NET> |
| Subject: | Re: Difference between VAR,ID,BY,CLASS |
| Content-Type: | text/plain; charset=ISO-8859-1 |
Raj,
I'd expand on Bob's response and make a couple of minor corrections.
First, the concepts aren't limited to proc summary, but are general to
many SAS procs. In fact, the documentation provides a lot more detail
in its section on proc summary's relative .. proc means (see, e.g.:
http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#/documentation/cdl/en/proc/61895/HTML/default/a000146728.htm
or, in short form: http://xrl.us/bhuwpz )
In some procs, 'table' or 'model' might be the keyword used rather
than 'var'.
The 'by' statement gives you a way to mix orders so that all don't
have to be ascending or descending, lets you use the #byval variable
and, I believe, requires less resources (thus can handle more complex
designs before confronting memory problems).
The ID statement gives you a way to include additional, non-summarized
values. The documentation provides more detail than I could provide
here but, rather than the first value encountered in a by or class
group combination, it can either be the minimum or maximum value
within a by or class group combination.
HTH,
Art
---------------
On Aug 1, 8:12 am, Bob <techsavvy...@yahoo.com> wrote:
> Here is a good article from SAS on the PROC SUMMARY. That is the
> procedure where those are primarily used.
>
> http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/v...
>
> CLASS and BY are used to tell SAS what variable(s) to use when
> summarizing the dataset. (The difference being BY variables must be
> presorted). ID is used to tell SAS, 'don't summarize by this variable,
> but display the first value for a given BY variable combination'. VAR
> is used for numeric variables you would like a calculation performed
> on (usually summation).
>
> Example:
> proc summary data=[input dataset] nway missing;
> class [var1] [var2];
> id [var3];
> var [var4];
> output out=[output dataset] sum=;
> run;
>
> This summarizes the input dataset by var1 and var2, displays var3, and
> subtotals var4 for each var1/var2 combination. Make sense?
>
> On Aug 1, 3:17 am, Raj <rajiv...@gmail.com> wrote:
>
>
>
> > Hi,
>
> > Can somebody explain where we use VAR,ID,BY,CLASS and what is the
> > difference between each one with an example.
>
> > Thanks for the help.
>
> > Regards,
> > Raj- Hide quoted text -
>
> - Show quoted text -
|