I’m trying to show a message or another table with empty record if the result is empty after putting an input.
See below codes:
%if (&number ne) %then %do;
Proc print data=Lib.table;
Var “number”n “name”n “age”n;
Where “number”n=“&number”;
Run;
%end;
The input is number This codes for stored process
Solution This is the solution that worked for me.
%if (&number ne) %then %do;
Proc print data=Lib.table;
Var “number”n “name”n “age”n;
Where “number”n=“&number”;
Run;
Proc sql;
Select case
when count()=0 then “No record found”
Else put (count()),11.)
End as Number_of_records
From Lib.table
where 'number'n="&number";
Quit;
%end;
You could check the table if the value exists, and if it does not, display a
proc printsaying that it is empty.For this to work, your STP result capabilities need to be set to "Stream."
Note that you can also write HTML to the special fileref
_weboutto display a message. If you do this, do not enclose the STP with the %STPBEGIN/%STPEND macros or_weboutwill be write-locked. For example: