BookmarkSubscribeRSS Feed
elessar
Calcite | Level 5

Hi,

Would like to know how to customize my report1 in PROC REPORT to look as report2?

 

That is what I have now: Report1


column1_____column2_____
AAAA_______C1_________
AAAA_______C2_________
AAAA_______C3_________
BBBB_______D1_________

BBBB_______D2_________

That is what I want to have: Report2


column1_____column2_____
AAAA_______C1_________
AAAA_______C2_________
AAAA_______C3_________
column1_____column2_____
BBBB_______D1_________

BBBB_______D2_________

 

I need to repeat a header before each section which group by column1.


Thanks!

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

With nothing to work with I can't provide code, at a guess I would say set the options to be break on nothing - How you do this depends on the output type.  Also set:

options nobyline;

Then do your proc report with:

by column1;

This will print each by group, with headers one after the other, again depending on output type.

 

When posting a question its very important to tell us some information about the question as we can't see your machine.  Show your code, present some test data in the form of a datastep or use the sashelp library datasets to show what you mean.

elessar
Calcite | Level 5

This is my code:

 

data person;
input column1 $1-4 column2 $6-7;
datalines;
AAAA C1
AAAA C2
AAAA C3
BBBB D1
BBBB D2
;

 

proc report data=work.PERSON;
column column1column2;

define column1 /group order=internal;
define column2 /display;

run;

pic1.png

 

Unfortunately, your decision makes two tables instead of one:   pic2.png   

My goal is: pic3.png

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Well, two tables is effectively what your asking for, a table is defined as one row for headers, then a row for each data item.  In the given case, can you not shrink the gap between the two, margins and such like.

@Ksharp has a nice suggestion with putting a row out per by group rather than breaking the table.

Ksharp
Super User
proc report data=sashelp.class nowd noheader;
column sex name  age;
define sex/group;
define name /display;
define age/display;
compute before sex;
line @1 'Sex' @6 'Name' @14 'Age';
endcomp;
run;

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2044 views
  • 0 likes
  • 3 in conversation