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-2024.png

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.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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