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

Let say that I Have a simple table that have four variables (Company, Profit_January, Profit_February, Profit_March).

I would like to display my report to be like this:

enter image description here

In which, the Profit_January, Profit_February, and Profit_March is under subgroup Profit. Is it achievable doing Proc Report?

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
Diamond | Level 26
Hi: It looks like "Profit" isn't a variable, but is just a spanning header. What code have you tried already? What does your COLUMN statement look like right now with PROC REPORT. Have you tried to use a spanning header?

Something like:
COLUMN Company ('Profit' profit_jan profit_feb profit_mar);

(I know, they are not the variable names you originally showed, but I didn't want to run out of real estate.

cynthia

View solution in original post

4 REPLIES 4
Cynthia_sas
Diamond | Level 26
Hi: It looks like "Profit" isn't a variable, but is just a spanning header. What code have you tried already? What does your COLUMN statement look like right now with PROC REPORT. Have you tried to use a spanning header?

Something like:
COLUMN Company ('Profit' profit_jan profit_feb profit_mar);

(I know, they are not the variable names you originally showed, but I didn't want to run out of real estate.

cynthia
anthony28852
Fluorite | Level 6

Hi Cynthia,

 

Thank you! It works fine for me, one more question if you don't mind. I got my table from transposing another table. Hence the column name is not static, for example it can be profit_march, profit_april, profit_may instead of profit_january, profit_february, profit_may depending on the given parameter.

 

If that is the case how do I define the Column? 

 

Thanks!

ballardw
Super User

If you transposed from a data set that had month as a variable you might be better off to go back to that and use month with a label of "Profit" as a column header. Sort order would probably be best to have month as the number of month and use a custom format to display the month's name so order=internal.

Or if you had actual date values use an appropriate format for a date.

Then you don't have to worry about changing numbers of months and adjusting a list of variables.

Ksharp
Super User
Try variable list method .
COLUMN Company ('Profit' profit_:  );
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
  • 2888 views
  • 4 likes
  • 4 in conversation