I have written the pseudo program below to demonstrate what I want to ask (I am writing a more complex function in reality). My macro function has 2 parameters, and as seen in the program I do an Nested %IF. Question 1: If I understand it correctly, Nested %IF (i.e. a Macro Nested IF) is only allowed inside a "Macro Wrapper" (and not in "open code"), i.e. it should be between %Macro and %Mend. Question 2: In the first %Else %Do in the program below, how would I tell SAS to do nothing, i.e. just continue? I am not entirely sure wether this makes sense either. Also, would it not be weird to exclude the code:
%else %do;
Nothing. * How do you tell SAS to do nothing, i.e. just continue?;
%end;
Since you then do not exhaust all the possible alternatives?
Question 3: I could in my macro write a help text (some kind of documentation) but it is quite uggly that the user must open the macro to read the help text. Any best practices for this? Question 3.1. Is it possible to add a help text of the kind shown with the picture:
%Macro MyMacro(VariableA, VariableB); /* Here I could write a help text to the user, but it is quite uggly that the user must open the function to get a feeling for it */ %if &VariableA. = Yes %then %do;
%if &VariableB. = B1 %then %do;
Run some Code
%end;
%else %if &VariableB = B2 %then %do;
Run some Code
%end;
%else %do;
Nothing. * How do you tell SAS to do nothing, i.e. just continue?;
%end;
%end;
%else %do;
%put Note: VariableA should be Yes to run the program. ;
%end;
%mend MyMacro;
Thanks.
... View more