BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
PrinceAde
Obsidian | Level 7

Hi all!

I'm trying to compute a blank line between the table header and the first row for each page. I have three pages, I was only able to add the blank for the first page only, using compute before, compute before _page_.

I hope to get some magic wand to make this happen.

 

Thanks in anticipation.

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

Make a PAGE variable, and note the number of obs in each PAGE is less than the number of row in a real pdf page;

 

data have;
input strain $ day $ cyto $ age $;
datalines;
wuhan 1 CD107a 18
wuhan 1 IFN? 18
wuhan 1 TNFa 18
wuhan 1 L-12 18
wuhan 1 CD107a 40
wuhan 1 IFN? 40
wuhan 1 TNFa 40
wuhan 1 L-12 40
wuhan 64 CD107a 18
wuhan 64 IFN? 18
wuhan 64 TNFa 18
wuhan 64 L-12 18
wuhan 64 CD107a 40
wuhan 64 IFN? 40 
wuhan 64 TNFa 40
wuhan 64 L-12 40
wuhan 120 CD107a 18
wuhan 120 IFN? 18
wuhan 120 TNFa 18
wuhan 120 L-12 18
wuhan 120 CD107a 40
wuhan 120 IFN? 40
wuhan 120 TNFa 40
wuhan 120 L-12 40
wuhan 360 CD107a 18
wuhan 360 IFN? 18
wuhan 360 TNFa 18
wuhan 360 L-12 18
wuhan 360 CD107a 40
wuhan 360 IFN? 40
wuhan 360 TNFa 40
wuhan 360 L-12 40
;
run;
data want;
set have;
if age= "18" then do;
agegrp = "18-39";
order=1;
end;
else if age = "40" then do;
agegrp = "40-60";
order=2;
end;
run;
 
data want;
set want;
output;
strain = "XE";
output;
run;
 
data want2;
 set want(in=ina)  want(in=inb)  want(in=inc);
if ina then page=1;
if inb then page=2;
if inc then page=3;
run;
 
ods escapechar="^";
ods pdf file="practice2.pdf";
title;
proc report data=want2 spanrows nowd ps=170 split='^' missing contents=""
 
style(report)={cellpadding=3pt cellspacing=0pt just=c frame=above asis=on rules=groups}
style(header)={font=('times',6pt, normal) just=C asis=Off textalign=center background=white borderbottomwidth=2 bordertopwidth=2}
style(column)={font=('times',7pt, normal) cellwidth=8% asis=on cellheight=0.0005}
style(lines) ={font=('times',4pt, normal)  asis=on};
   column page strain day agegrp Cyto;
define page/order noprint;
    define strain    / style={just=c asis=on cellwidth=6% vjust=center} order            flow;
    define day       / style={just=c asis=on cellwidth=7% vjust=center} "Day"  order     flow;
    define agegrp    / style={just=c asis=on cellwidth=9% vjust=center} "Age Group" order flow;
    define Cyto      / style={just=c asis=on cellwidth=7%} "Cytokine" display flow;

compute before page/style={background=navy};   /*Change it into WHITE*/
line " ";
endcomp;

break after page/page;
run;
ods pdf close;
 

Ksharp_0-1697361812868.png

 

View solution in original post

6 REPLIES 6
Kurt_Bremser
Super User
  • Example data
  • Your current code
  • The complete log, if WARNINGs,  ERRORs or unexpected NOTEs happen
  • The expected result
  • A clear description where the result does not meet your expectations
PrinceAde
Obsidian | Level 7
I don't have error in the log. I expect to have a single blank line between the header and the body(the first row). In this example I have two pages, only the first page inserted the blank line. Please run the code below to see.
I have tried compute before(after) _page_; line " "; endcomp; both did not work.
 
Thank You.
data have;
input strain $ day $ cyto $ age $;
datalines;
wuhan 1 CD107a 18
wuhan 1 IFN? 18
wuhan 1 TNFa 18
wuhan 1 L-12 18
wuhan 1 CD107a 40
wuhan 1 IFN? 40
wuhan 1 TNFa 40
wuhan 1 L-12 40
wuhan 64 CD107a 18
wuhan 64 IFN? 18
wuhan 64 TNFa 18
wuhan 64 L-12 18
wuhan 64 CD107a 40
wuhan 64 IFN? 40 
wuhan 64 TNFa 40
wuhan 64 L-12 40
wuhan 120 CD107a 18
wuhan 120 IFN? 18
wuhan 120 TNFa 18
wuhan 120 L-12 18
wuhan 120 CD107a 40
wuhan 120 IFN? 40
wuhan 120 TNFa 40
wuhan 120 L-12 40
wuhan 360 CD107a 18
wuhan 360 IFN? 18
wuhan 360 TNFa 18
wuhan 360 L-12 18
wuhan 360 CD107a 40
wuhan 360 IFN? 40
wuhan 360 TNFa 40
wuhan 360 L-12 40
;
run;
data want;
set have;
if age= "18" then do;
agegrp = "18-39";
order=1;
end;
else if age = "40" then do;
agegrp = "40-60";
order=2;
end;
run;
 
data want;
set want;
output;
strain = "XE";
output;
run;
 
 
 
ods escapechar="^";
ods pdf file="practice2.pdf";
title;
proc report data=want spanrows  ps=170 split='^' missing contents=""
 
style(report)={cellpadding=3pt cellspacing=0pt just=c frame=above asis=on rules=groups}
style(header)={font=('times',6pt, normal) just=C asis=Off textalign=center background=white borderbottomwidth=2 bordertopwidth=2}
style(column)={font=('times',7pt, normal) cellwidth=8% asis=on cellheight=0.0005}
style(lines) ={font=('times',4pt, normal)  asis=on};
   column strain day agegrp Cyto;
    define strain    / style={just=c asis=on cellwidth=6% vjust=center} order            flow;
    define day       / style={just=c asis=on cellwidth=7% vjust=center} "Day"  order     flow;
    define agegrp    / style={just=c asis=on cellwidth=9% vjust=center} "Age Group" order flow;
    define Cyto      / style={just=c asis=on cellwidth=7%} "Cytokine" display flow;
compute after agegrp/style={cellpadding=1pt cellheight=0.005 just=c};;
line " ";
endcomp;
compute before;
line " ";
endcomp;
run;
ods pdf close;

 

Cynthia_sas
SAS Super FREQ
Hi:
A similar question has been posted here https://communities.sas.com/t5/SAS-Programming/proc-report-table/m-p/898604#M355186 regarding the insertion of a blank line. As explained in that previous posting, use of options like HEADLINE, HEADSKIP and FLOW are listing only options which will be ignored by ODS destinations like PDF. In addition, as shown in my examples in the other posting, you probably do not need the ASIS=ON style override or the attempt to overcontrol the cellwidths.
Cynthia
PrinceAde
Obsidian | Level 7

@Cynthia_sas I created a new variable to break the page and so computed a blank line the same variable.  

 

Thanks for your help.

ballardw
Super User

Yet another incomplete description of what you "want".

 

What variable in your data set is controlling where the PAGE breaks? If YOU do not control the page break there is almost no chance that code will in any consistent manner.

Ksharp
Super User

Make a PAGE variable, and note the number of obs in each PAGE is less than the number of row in a real pdf page;

 

data have;
input strain $ day $ cyto $ age $;
datalines;
wuhan 1 CD107a 18
wuhan 1 IFN? 18
wuhan 1 TNFa 18
wuhan 1 L-12 18
wuhan 1 CD107a 40
wuhan 1 IFN? 40
wuhan 1 TNFa 40
wuhan 1 L-12 40
wuhan 64 CD107a 18
wuhan 64 IFN? 18
wuhan 64 TNFa 18
wuhan 64 L-12 18
wuhan 64 CD107a 40
wuhan 64 IFN? 40 
wuhan 64 TNFa 40
wuhan 64 L-12 40
wuhan 120 CD107a 18
wuhan 120 IFN? 18
wuhan 120 TNFa 18
wuhan 120 L-12 18
wuhan 120 CD107a 40
wuhan 120 IFN? 40
wuhan 120 TNFa 40
wuhan 120 L-12 40
wuhan 360 CD107a 18
wuhan 360 IFN? 18
wuhan 360 TNFa 18
wuhan 360 L-12 18
wuhan 360 CD107a 40
wuhan 360 IFN? 40
wuhan 360 TNFa 40
wuhan 360 L-12 40
;
run;
data want;
set have;
if age= "18" then do;
agegrp = "18-39";
order=1;
end;
else if age = "40" then do;
agegrp = "40-60";
order=2;
end;
run;
 
data want;
set want;
output;
strain = "XE";
output;
run;
 
data want2;
 set want(in=ina)  want(in=inb)  want(in=inc);
if ina then page=1;
if inb then page=2;
if inc then page=3;
run;
 
ods escapechar="^";
ods pdf file="practice2.pdf";
title;
proc report data=want2 spanrows nowd ps=170 split='^' missing contents=""
 
style(report)={cellpadding=3pt cellspacing=0pt just=c frame=above asis=on rules=groups}
style(header)={font=('times',6pt, normal) just=C asis=Off textalign=center background=white borderbottomwidth=2 bordertopwidth=2}
style(column)={font=('times',7pt, normal) cellwidth=8% asis=on cellheight=0.0005}
style(lines) ={font=('times',4pt, normal)  asis=on};
   column page strain day agegrp Cyto;
define page/order noprint;
    define strain    / style={just=c asis=on cellwidth=6% vjust=center} order            flow;
    define day       / style={just=c asis=on cellwidth=7% vjust=center} "Day"  order     flow;
    define agegrp    / style={just=c asis=on cellwidth=9% vjust=center} "Age Group" order flow;
    define Cyto      / style={just=c asis=on cellwidth=7%} "Cytokine" display flow;

compute before page/style={background=navy};   /*Change it into WHITE*/
line " ";
endcomp;

break after page/page;
run;
ods pdf close;
 

Ksharp_0-1697361812868.png

 

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