Hi I have a data set arranged as follows:
Utility Year Sector Load
I know that I can use the "across" keyword in proc report so that i can show load by sector but I want to supress the printing of the label "Sector".
------------------Sector---------------------
Utility Year Residential Commercial Industrial
What I want to do in proc report is to apply the "across" to the column labeled "Sector" but I want my results displayed as below:
Utility Year Residential Commercial Industrial
I think I can use proc transpose to rotate the data but I would like to avoid having to create another intermediate table if possible.
Thanks.
Hi,
Read about the define statement in proc report.
What you are looking for is
define sector / across "";
The blank quotes will supress the label.
Hi,
Read about the define statement in proc report.
What you are looking for is
define sector / across "";
The blank quotes will supress the label.
NN: your answer does what I want but now I have another complication.
this is my code:
proc report data = Consumpt nowd split ='\' ;
column PAN Year Sector,High High=stot ;
define PAN / group noprint ;
define Year / group ;
define Sector / across "" format = Sectorid. order = internal ;
define High / "" analysis STYLE(column)={TAGATTR='format:#,##0'} ;
define stot / 'Total Consumption' sum STYLE(column)={TAGATTR='format:#,##0'} ;
where put(PAN,Paid.) = "IID" ;
quit ;
here is the result (example table):
but what i need is this format:
are there some options that i need to use to control how columns are placed to fix the layout?
Hi,
Read about spanned headers in proc report.
to get your desired output you can try this
proc report data = Consumpt nowd split ='\' ;
column PAN ('Year' Year) Sector,High ('Total Consumption' High=stot) ;
define PAN / group noprint ;
define Year / group '' ;
define Sector / across "" format = Sectorid. order = internal ;
define High / "" analysis STYLE(column)={TAGATTR='format:#,##0'} ;
define stot / '' sum STYLE(column)={TAGATTR='format:#,##0'} ;
where put(PAN,Paid.) = "IID" ;
quit ;
This should work.
thank you so much! you have really made my day!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.