03-30-2017 03:00 PM
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=;
The output dataset is giving me every variable in the original dataset DC06. I only want to keep the ones listed here. Please help.
03-30-2017 03:12 PM - edited 03-30-2017 03:12 PM
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;
03-30-2017 03:16 PM
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.