BookmarkSubscribeRSS Feed
Ronein
Meteorite | Level 14
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
Meteorite | Level 14
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
Meteorite | Level 14
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

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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