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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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