Hi SAS experts,
The following program works perfect when "style(column)={asis=on font=('Courier New',8pt) background=white};" is specified in the macro. But after the font is changed to Arial, like, ' "style(column)={asis=on font=('Arial',9pt) background=white};". It can't be alligned any more. Please help! Thank you in advance.
%macro Lpagenum(filein, fileout);
data _numpage;
retain numpages 0;
infile "&filein" length = vlg;
input @1 line $varying134. vlg;
if _n_ =1 then call symput("Ltitle1",line);
if index(upcase(line), upcase("Page X of X")) > 0 then numpages + 1;
call symput("numofpages",compress(put(numpages,5.)));
run;
data _odsprn;
retain num 1 pageno 0 lineno 0;
length line $134.;
infile "&filein" length = vlg end = fin;
n=_n_;
input @1 line $varying134. vlg;
if upcase(substr(line, 1, length(line))) = upcase(substr("&Ltitle1", 1)) then put _page_;
point = index(upcase(line),upcase("Page X of X"));
if point > 0 then do;
if &numofpages > 0 then do;
line = trim(substr(line, 1, point + 4)) ||" "|| compress(put(compress(num), 8.))||" of &numofpages";
linelen=length(trim(line));
line=trim(line)||repeat(" ",134-linelen-38)||"Data Last Modified: &moddate.";
end;
else line = substr(line, 1, point - 1);
num + 1;
end;
if 5>index(line,trim("&Ltitle1"))>0 then do;
pageno+1;
lineno=0;
line="&Ltitle1";
end;
lineno+1;
run;
proc sort data=_odsprn;
by pageno n;
run;
ods rtf file="&fileout" style=hpeg headery=720 footery=720;
options orientation=landscape;
ods listing close;
proc report data=_odsprn nowd ls=134 ps=49
style(report)={asis=on just=center cellpadding=0 frame=void rules=none}
/* style(column)={asis=on font=('Courier New',8pt) background=white};*/
style(column)={asis=on font=('Arial',9pt) background=white};
column pageno line;
define pageno / noprint group;
define line /" " width=134;
break after pageno / page;
run;
ods rtf close;
ods listing;
%mend Lpagenum;
proc printto new file="&OUTDIR.\TABLES_TEMP.rtf";
run;
proc report data =sashelp.cars nowd center headline headskip split='*' ps=52 ls=134;
column model DriveTrain origin type Horsepower Weight length;
define model/left width=40;
define DriveTrain/left width=10;
define origin/left width=10;
define type/left width=10;
define horsepower/left width=10;
define weight/left width=10;
define length/left width=10;
compute before _page_;
line @1 "sponsor" @109 "Page X of X";
line @1 "protocol" ;
line " ";
line @50 "ttl1";
line @50 "ttl2";
line @50 "ttl3";
line @1 134*"_";
line " ";
endcomp;
run;
quit;
proc printto; run;
%Lpagenum(&OUTDIR.\tables_temp.rtf, &OUTDIR.\test&OUTNAME.);
Part of the problem may be that Courier New is a fixed-width font, while Arial is a proportional font. The PROC REPORT code looks like it's set up for a fixed-width font.
http://home.myfairpoint.net/vzenu5ot/portfolio/sg_items/mono_propor_font_example.htm has a couple of examples that show the difference between a fixed-width font and a proportional font.
Part of the problem may be that Courier New is a fixed-width font, while Arial is a proportional font. The PROC REPORT code looks like it's set up for a fixed-width font.
http://home.myfairpoint.net/vzenu5ot/portfolio/sg_items/mono_propor_font_example.htm has a couple of examples that show the difference between a fixed-width font and a proportional font.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.