Changes and Enhancements to PROC MEANS

by Irina 14. May 2007 11:02
  1. PROC MEANS dramatically simplifies creation of multiple output SAS data sets in a single use of PROC MEANS.

    Example:
    Data A B C:
    SET NEW;
    IF _TYPE_ = '1001'B then OUTPUT A;
    ELSE IF _TYPE_ = '1011'B
    then OUTPUT B;
    ELSE IF _TYPE_ = '0110'B then
    OUTPUT 'C';
    RUN;
  2.  New OUTPUT statement option combines and extends the features of the ID statement, the IDMIN option in the PROC MEANS statement and the MAXID and MINID options in the Output statement so that you can create an output data set containing variables identifying multiple extreme values of the analysis variables.

          Example:

data gains;
    input name $ sex $ height  weight  school $  time;
cards;
Alfred  M 69.0 122.5 AJH  1
Alfred  M 71.0 130.5 AJH  2
Alicia  F 56.5  84.0 BJH  1
Alicia  F 60.5  86.9 BJH  2
Benicia F 65.3  98.0 BJH  1
Benicia F 69.3  99.1 BJH  2
Bennett F 63.2  96.2 AJH  1
Bennett F 69.2  98.2 AJH  2
Carol   F 62.8 102.5 BJH  1
Carol   F 65.3 105.4 BJH  2
Carlos  M 63.7 102.9 AJH  1
Carlos  M 70.3 106.9 AJH  2
Henry   M 63.5 102.5 AJH  1
Henry   M 68.9 108.6 AJH  2
Jaime   M 57.3  86.0 BJH  1
Jaime   M 62.9  90.0 BJH  2
Janet   F 59.8  84.5 AJH  1
Janet   F 62.5  86.5 AJH  2
Jean    M 68.2 113.4 AJH  1
Jean    M 70.3 116.0 AJH  2
Joyce   M 51.3  50.5 BJH  1
Joyce   M 55.5  53.5 BJH  2
Luc     M 66.3  77.0 AJH  1
Luc     M 69.3  82.9 AJH  2
Marie   F 66.5 112.0 BJH  1
Marie   F 69.5 114.9 BJH  2
Medford M 64.9 114.0 AJH  1
Medford M  .     .    .   .
Philip  M 69.0 115.0 AJH  1
Philip  M 70.0 118.0 AJH  2
Robert  M 64.8 128.0 BJH  1
Robert  M 68.3   .   BJH  2
Thomas  M 57.5  85.0 AJH  1
Thomas  M 59.1  92.3 AJH  2
Wakana  F 61.3  99.0 AJH  1
Wakana  F 63.8 102.9 AJH  2
William M 66.5 112.0 BJH  1
William M 68.3 118.2 BJH  2
;
proc means data=gains;
   var height weight;
   class sex;
   output out=test
           max=maxht maxwght
           maxid(height(name) weight(name))=tallest heaviest
		   minid(height(name) weight(name))=smallest easiest

run;

Tags: proc_means

SAS

Related posts

Add comment


(will show your Gravatar icon)  





Live preview

7/30/2010 8:13:11 AM

 

About the author

Irina Spivak Irina Spivak
Team Leader at G-Stat. More...


Send mail Email

Authors

Blogroll

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2010

    Sign in

    eXTReMe Tracker