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

Hello Community,

 

I  just want one blank line in between my records of two groups. 

 

My data:

 

data report;
  input variable $ value $ group ;
  cards; 
Sex F 1
Sex M 1
Age <18 2
Age 18-30 2
Age 31-50 2
Age >50 2
;
run;

This is what I need in the pdf report:

image.png

I have tried this: 

 

ods escapechar='~';
ods pdf file='line_test.pdf';
proc report nofs data=report headline ;
  columns group variable value ;
  define group    / order noprint ;
  define variable / display ;
  define value     / display ;
 compute after group / style={fontsize=0.1pt };
    length msg $ 64;

    if group=1 then do;
      msg = "~{newline 10}";
    end;
    else do;
      msg = "~{newline 0}";
    end;

    line msg $64.;
  endcomp;
run;
ods pdf close;

In html view it shows as I needed, but in pdf its different. In pdf it shows as :

image.png

I just need only a blank line in between and not at the end.

 

 

Thanks,
Suryakiran
1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
data report;
  input variable $ value $ group ;
  cards; 
Sex F 1
Sex M 1
Age <18 2
Age 18-30 2
Age 31-50 2
Age >50 2
;
run;
proc sql noprint;
select max(group) into : n from report;
quit;
proc report nowd data=report headline ;
  columns group variable value ;
  define group    / order noprint ;
  define variable / display ;
  define value     / display ;
 compute after group ;
  str=' ';
  len=ifn(group=&n,0,10);
  line str $varying10. len;
 endcomp;
 run;

View solution in original post

2 REPLIES 2
Ksharp
Super User
data report;
  input variable $ value $ group ;
  cards; 
Sex F 1
Sex M 1
Age <18 2
Age 18-30 2
Age 31-50 2
Age >50 2
;
run;
proc sql noprint;
select max(group) into : n from report;
quit;
proc report nowd data=report headline ;
  columns group variable value ;
  define group    / order noprint ;
  define variable / display ;
  define value     / display ;
 compute after group ;
  str=' ';
  len=ifn(group=&n,0,10);
  line str $varying10. len;
 endcomp;
 run;
SuryaKiran
Meteorite | Level 14

Thank you @Ksharp , this works as expected. 

Thanks,
Suryakiran

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
  • 2 replies
  • 1637 views
  • 1 like
  • 2 in conversation