Help using Base SAS procedures

Cannot proc summary output by date

Reply
N/A
Posts: 1

Cannot proc summary output by date

Hello world,

I'm currently trying output a summary of an existing dataset into a new file (containing only only the summary values).  I've tried using the class specifier to summarize (mean, sum, etc.) each variable by date, but after checking the output file, I noticed it still retained each original observation instead of summarizing by date.  Thanks in advance for any help!

-John

Here's my code (mtsudat library is already referenced): 

proc summary data = sasuser.marchflights maxdec=2 sum mean;

  class date;

  var distance mail freight boarded transferred nonrevenue passengercapacity;

output out = mtsudat.marchflights;

run;

Super Contributor
Posts: 358

Cannot proc summary output by date

Try:

proc summary data = sasuser.marchflights maxdec=2 sum mean;

  class date;

  var distance mail freight boarded transferred nonrevenue passengercapacity;

output out = mtsudat.marchflights (drop=_TYPE_ _FREQ_) SUM=;

run;

Frequent Contributor
Posts: 104

Re: Cannot proc summary output by date

proc summary data=sasuser.marchflights missing;     *--- missing option outputs missing class values as well;

     class date;                                    *--- you can attach formats to dates to get monthly, qtrly summaries easily;

     var x1 x2 x3;

     output out=mtsudat.marchflightsummary(drop=_Smiley Happy     /*  drop _type_ _freq_  */

          sum=x1sum x2sum x3sum

          n=x1n x2n x3n

          std(x1)=x1std

     ;

run;

proc summary by default prints nothing, so maxdec=2 has no effect, nor does the mean option.  They are meaningful for PROC MEANS printed output.

Super User
Posts: 9,671

Re: Cannot proc summary output by date

You should use nway option and define the sum  mean ... at output statement.

proc means noprint data=sashelp.class maxdec=2 sum mean nway;
 class sex;
 var weight height;
 output out=want sum= mean= /autoname;
run;


Ksharp

Ask a Question
Discussion stats
  • 3 replies
  • 224 views
  • 0 likes
  • 4 in conversation