Differences between revisions 1 and 2
Revision 1 as of 2023-01-14 04:41:49
Size: 548
Comment:
Revision 2 as of 2023-01-14 05:38:04
Size: 1136
Comment:
Deletions are marked like this. Additions are marked like this.
Line 12: Line 12:
proc means data=LIBREF.TABLE N mean median sum min max maxdec=2; proc means data=LIBREF.TABLE STATSLIST maxdec=2;
Line 14: Line 14:
  class GROUPVAR1 GROUPVAR2;   class CLASSVARLIST;
Line 18: Line 18:

`STATSLIST` can be any combination of:

 * `mean`
 * `std`
 * `stderr`
 * `sum`
 * `median`
 * `min`
 * `max`
Line 29: Line 39:
----



== Output ==

To store the `STATSLIST` variables for each `CLASS` group, try:

{{{
proc means data=LIBREF.TABLE noprint;
  var VARLIST;
  class CLASSVARLIST;
  ways N;
  output out=LIBREF.TABLE2(drop=_FREQ_ _TYPE_);
run;
}}}

To explicitly name the `STATSLIST` variables, try:

{{{
proc means data=LIBREF.TABLE mean max noprint;
  var Price;
  class Region;
  ways 1;
  output out=LIBREF.TABLE2(drop=_FREQ_ _TYPE_) mean=MeanPrice max=MaxPrice;
run;
}}}

SAS Means


Usage

proc means data=LIBREF.TABLE STATSLIST maxdec=2;
  var VARLIST;
  class CLASSVARLIST;
  ways 2;
run;

STATSLIST can be any combination of:

  • mean

  • std

  • stderr

  • sum

  • median

  • min

  • max

Class Statement

Ways Statement

The WAYS statement takes any number from 0 to the number of CLASS variables. A value of 0 ignores the classes. A value of 1 runs statistics for each single group. A value of 2 runs statistics for each combination of 2 groups. And so on.


Output

To store the STATSLIST variables for each CLASS group, try:

proc means data=LIBREF.TABLE noprint;
  var VARLIST;
  class CLASSVARLIST;
  ways N;
  output out=LIBREF.TABLE2(drop=_FREQ_ _TYPE_);
run;

To explicitly name the STATSLIST variables, try:

proc means data=LIBREF.TABLE mean max noprint;
  var Price;
  class Region;
  ways 1;
  output out=LIBREF.TABLE2(drop=_FREQ_ _TYPE_) mean=MeanPrice max=MaxPrice;
run;


CategoryRicottone

SAS/Means (last edited 2023-03-30 20:47:01 by DominicRicottone)