I am not sure if I get any answer on a saturday evening, but I will give a shout :)
I am trying to automize a SAS-code which does comparison in a viariable between 2-3 companies. In each task, I will probably work with different companies, so I guess I can only enter the company names manually.
I describe macro-variables for each company, for example:
%let C1=CompanyNo1; %let C2=CompanyNo2; %let C3=CompanyNo3;
and then I only put &C1
in the remaining code. If I work for another company no later, then I only change the CompanyNo1 in the code.
However, the problem is that I may need to do the comparison between different number of companies later. If I write the code for 4 companies, and if I need to do the comparison between 2 companies in the next run, then I have to deactivate some part of the code.
So I want to write an existince check in the code like;
data _null_;
if &C3 is true then continue the run;
else if quit the code.
run;
Someone told me that I can do that with %Macro
statement(he said maybe, he wasn't sure). But I am not sure how to achieve this with %Macro
.
Thanks for any contribution in advance...
Finally I found an effective solution.
So if there is no CompanyNo3, then SAS gives only a warning that CompanyNo3 is not attended. Then it goes to
exit
, it doesn't do other data processes. It finalizes the process without error message.