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;
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);
Thanks. Works nicely.
Bruce
First, thank you so much for posting this pdf editing issue here. Since you have solved the pdf text processing problem, would you please mark it as solved. Thanks.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: