PROC Summary Question

Reply
Occasional Learner
Posts: 1

PROC Summary Question

I need the syntax to get a summary but only keep specific variables from the dataset, not everything in proc contents. My code looks like this:

 

PROC SUMMARY DATA=DC06 NWAY MISSING;

CLASS DUE_STAGE ICS_CUT;

VAR ROLL ROLL_BAL CURR_BAL;

ID SYS_NUM MOB_CUT RANDOM_DIGIT UTILIZATION STATE_CD BAL_CUT CREDIT_LIMIT NSF_CNT FIRST_PMT_DFLT_FLAG;

OUTPUT OUT=SUMMARY_DC06 (RENAME=(_FREQ_=NUMACCT) DROP=_TYPE_) SUM=;

RUN;

 

The output dataset is giving me every variable in the original dataset DC06. I only want to keep the ones listed here. Please help.

 

Super User
Posts: 17,840

Re: PROC Summary Question

[ Edited ]

I can't replicate your issue. 

Can you post a proc contents from DC06 and Summary_DC06?

 

Note, that all variables in your ID statement get included, is that what's causing your issue?

 

proc summary data=sashelp.class nway missing;
class sex;
var weight;
id name;
output out=summary sum=;
run;

proc print data=summary;run;

 

PROC Star
Posts: 288

Re: PROC Summary Question

Can you show the proc contents of SUMMARY_DC06? And maybe DC06 as well? 

Super User
Posts: 5,083

Re: PROC Summary Question

PROC SUMMARY only does what it is told.  For example, if you don't want the variables in the ID statement, get rid of them (or possibly get rid of the entire ID statement).  It's not a requirement for running PROC SUMMARY.

 

A longshot:  PROC SUMMARY contained an error and thus did not replace SUMMARY_DC06 so you are looking at an older version of the summary data set.

Ask a Question
Discussion stats
  • 3 replies
  • 105 views
  • 1 like
  • 4 in conversation