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.
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;
Can you show the proc contents of SUMMARY_DC06? And maybe DC06 as well?
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.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.