user1481397
user1481397

Reputation: 433

SAS, print statement in the report

I have data A, then I will run some code and print the report as pdf.

ods pdf file="path/name.pdf";
if table A doesn't have any obs, then print the statement "No observations" to the final pdf report, 
else if table has obs, then print the statement "here is the table A" to the final pdf report. 

proc print data =TableA;run;

ods pdf close;

Upvotes: 1

Views: 212

Answers (1)

Lee
Lee

Reputation: 1427

data _NULL_;
    file print;
    if e then put 'No observations';
    set TableA end=e;
    put 'here is the table A';
    stop;
run;

when table is empty execution stops at set but e is set to 1 before set so the first if statement execute. When it is not empty execution stops at stop.

Upvotes: 1

Related Questions