The SAS Output Delivery System and reporting techniques

Dynamically produce Text in PDF Document Using Ods pdf text

Reply
Contributor
Posts: 36

Dynamically produce Text in PDF Document Using Ods pdf text

Hi,

I want to write a line in a report that is execute only is there is missing data. As an example below: New York does not report so I would like to print that in my report and not print anything is all sites report. I've gotten this far, but don't know how to produce the ods pdf text statement dynamically.

ods pdf;

data test_data;

input site  $30. ;

cards;

Dallas Ft Worth

Cleveland

Chicago

;

run;

data lookup;

input facility $30. ;

cards;

Dallas Ft Worth

Cleveland

Chicago

New York

;

run;

proc sql;

create table WhoIsMissing

as select a.site, b.facility

from test_data as a

right join lookup as b

on a.site=b.facility;

quit;

/*put the name into a macro variable;*/

proc sql noprint;

select  facility into:missing

from whoismissing

where site='';

quit;

%put &missing;

/*If there is no value in the macro variable then do nothing.*/

/*if there is a data value in the macro variable the print it*/

/*stumped here on how to do this dynamically*/

/*Also not sure how to deal with two or more missing sites*/

Ods pdf text="^S={font=('Arial' ,12pt, bold ) just=center } Site &Missing is missing";

ods pdf close;

Grand Advisor
Posts: 17,313

Re: Dynamically produce Text in PDF Document Using Ods pdf text

1. %if %then %do to control macro execution:

%macro test(value);

%if &value=%str() %then %do;

%put "Macro Variable is empty";

%end;

%else %do;

%put "Macro Variable is:" &value;

%end;

%mend;

%test();

%test(one);

%test(23);

%test();

%test(3kdjklfa);

Contributor
Posts: 36

Re: Dynamically produce Text in PDF Document Using Ods pdf text

Thanks. Works nicely.

Bruce

Occasional Contributor
Posts: 9

Re: Dynamically produce Text in PDF Document Using Ods pdf text

First, thank you so much for posting this pdf editing issue here.Smiley Happy Since you have solved the pdf text processing problem, would you please mark it as solved. Thanks.Smiley Wink

Ask a Question
Discussion stats
  • 3 replies
  • 679 views
  • 0 likes
  • 3 in conversation