BookmarkSubscribeRSS Feed
Ronein
Onyx | Level 15
Hello
I am using proc print with ID+By options.
What is the way that the column titles will appear only one time?

 
 
Data have;
Input ID JobCode $ Gender $ Salary;
cards;
111 FA1 F 23177
222 FA1 F 22454
333 FA1 M 22268
444 FA2 F 28888
555 FA2 F 27787
666 FA2 M 28572
777 FA3 F 32886
888 FA3 F 33419
999 FA3 M 32217
;
Run;

proc print data=have;
id jobcode;
by jobcode;
var gender salary;
run;
5 REPLIES 5
ballardw
Super User

Please look at that data step and check for completeness. There is no way you got that output from that data set.

 


@Ronein wrote:

Hello

I am using proc print with ID+By options.

What is the way that the column titles will appear only one time?

Ronein_0-1666209243843.png

 

 

Data have;
Input  CustID  JobCode $   Gender $  Salary;
cards;
111
222
333
444
555
666
777
888
999
;
Run;

proc print data=have;
 id jobcode;
 by jobcode;
 var gender salary;
run;

 

Ronein
Onyx | Level 15
There was missing data in the data step and I fixed it.
The question is how to create the report by group with one row of columns titles .
Please note that in this report there is no summary calculation
Tom
Super User Tom
Super User

What type of output are you generating?

Your code runs fine when I run it.

Normal output

Job
Code    Gender    Salary

FA1       F        23177
          F        22454
          M        22268


FA2       F        28888
          F        27787
          M        28572


FA3       F        32886
          F        33419
          M        32217



HTML output

Tom_0-1666214352912.png

 

Ronein
Onyx | Level 15
Please.pook at the attached photo where you can see the wanted report. As you can see in the wanted report I want to have one line of columns headers .
Ksharp
Super User
Data have;
Input ID JobCode $ Gender $ Salary;
cards;
111 FA1 F 23177
222 FA1 F 22454
333 FA1 M 22268
444 FA2 F 28888
555 FA2 F 27787
666 FA2 M 28572
777 FA3 F 32886
888 FA3 F 33419
999 FA3 M 32217
;
Run;

proc report data=have nowd;
columns JobCode  Gender  Salary;
define  JobCode/order;
define  Gender/display;
run;

Ksharp_0-1666266356366.png

 

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
  • 5 replies
  • 1084 views
  • 0 likes
  • 4 in conversation