BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
asishgautam
Calcite | Level 5

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.

1 ACCEPTED SOLUTION

Accepted Solutions
NN
Quartz | Level 8 NN
Quartz | Level 8

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

4 REPLIES 4
NN
Quartz | Level 8 NN
Quartz | Level 8

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.

asishgautam
Calcite | Level 5

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?

NN
Quartz | Level 8 NN
Quartz | Level 8

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.

asishgautam
Calcite | Level 5

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

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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