Should be a simple one for someone but been stuck on this for a while now.
I'm using a proc report with an out function. All works fine except that with the output the columns are headed _C1_, _C2_...etc.
I just want them to stay as the headings in the proc report.
Labelling individually is not an option as they are months and will be showing the most recent 12 months and so changing every time. code used below, pretty simple stuff.
proc report data = data (where=(
month > &year_Month
and month <= ¤t_Month))
out=test1;
columns sector month, exposure;
define sector/group;
define month/across;
define exposure/analysis sum format=comma14.;
run;
Sums by month and sector are easily handled by PROC SUMMARY, giving you complete control over the naming of the variables. If it must be in some tabular form, then PROC TRANSPOSE will get you there.
I would tend to avoid using across. Simply transpose your data before the proc report, that way you then have a nice dataset which you can QC. The _c1_ is automatic variable labelling, depending on how you have your data - which you have not shown - a transpose will allow you to label and specify name of variables, e.g;
data have; id=1; lab="abc"; nam="VAR1"; val=1; output; id=1; lab="def rft"; nam="VAR2"; val=5; output; run; proc transpose data=have; by id; var val; id nam; idlabel lab; run;
So nam variable will be name of variable, lab will contain the label for it. You can then report the above quite simply with:
columns _all_;
Sums by month and sector are easily handled by PROC SUMMARY, giving you complete control over the naming of the variables. If it must be in some tabular form, then PROC TRANSPOSE will get you there.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: