The SAS Output Delivery System and reporting techniques

proc report and across

Accepted Solution Solved
Reply
Contributor
Posts: 66
Accepted Solution

proc report and across

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.


Accepted Solutions
Solution
‎08-25-2011 12:55 PM
Regular Contributor
Regular Contributor
Posts: 166

proc report and across

Posted in reply to asishgautam

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.

View solution in original post


All Replies
Solution
‎08-25-2011 12:55 PM
Regular Contributor
Regular Contributor
Posts: 166

proc report and across

Posted in reply to asishgautam

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.

Contributor
Posts: 66

proc report and across

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):

bad.JPG

but what i need is this format:

good.JPG

are there some options that i need to use to control how columns are placed to fix the layout?

Regular Contributor
Regular Contributor
Posts: 166

proc report and across

Posted in reply to asishgautam

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.

Contributor
Posts: 66

proc report and across

thank you so much! you have really made my day!

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 293 views
  • 3 likes
  • 2 in conversation