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

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