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

Hello there,

 

I want to merge two columns so that they are shown as one when using PROC REPORT.

 

 

data have;
   input condition $ Today Yesterday Diff;
   datalines;
AAA 18 17 1
BBB 3524 3541 -17
CCC 773 781 -8
DDD 1721 1721 0
EEE 26 26 0
FFF 5 3 2
;
run;


PROC REPORT DATA=have;	
COLUMN condition Today ('Yesterday' Yesterday Diff);
run;

 

 

The output of the above is:

 

Zatere_0-1607506204568.png

 

What I want is:

 

Zatere_1-1607506313329.png

Any ideas please?

Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

Define the columns without labels, and create "super-labels" for all:

PROC REPORT DATA=have;	
COLUMN ("Condition" condition) ("Today" Today) ('Yesterday' Yesterday Diff);
define condition / "" display;
define today / "" display;
define yesterday / "" display;
define diff / "" display;
run;

View solution in original post

1 REPLY 1
Kurt_Bremser
Super User

Define the columns without labels, and create "super-labels" for all:

PROC REPORT DATA=have;	
COLUMN ("Condition" condition) ("Today" Today) ('Yesterday' Yesterday Diff);
define condition / "" display;
define today / "" display;
define yesterday / "" display;
define diff / "" display;
run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1 reply
  • 909 views
  • 2 likes
  • 2 in conversation