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

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.);

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

I think this has to do with the specific font you're using, Arial. There's a write up on this thread that explains why Arial doesn't align:

 

https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-PDF-w-Proportional-Font-Arial-not-uniform-...

 

 

View solution in original post

2 REPLIES 2
Reeza
Super User

I think this has to do with the specific font you're using, Arial. There's a write up on this thread that explains why Arial doesn't align:

 

https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-PDF-w-Proportional-Font-Arial-not-uniform-...

 

 

fbl204653
Obsidian | Level 7

Hi Reeza, this is the 2nd time you helped me. Thank you very much!

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
  • 876 views
  • 0 likes
  • 2 in conversation