Does anyone know a way to convert the MS Access iif function to a case statement *in bulk*?
I'm converting Access apps to SAS and found one with dozens of iif statements and I thought it would be 'fun' (sick, yes, I know) to try to come up with a way to take this:
IIf(MEPE_ELIG_IND="Y",MEME_LAST_NAME,Null)
and write a macro so that I could simply do this:
%IIf(MEPE_ELIG_IND="Y",MEME_LAST_NAME,Null)
that would convert that to
case when MEPE_ELIG_IND="Y" then MEME_LAST_NAME else Null end
I thought I'd be clever and just come up with something like this:
%macro iif(condition,true,else);
case when &condition then &true else &else end
%mend iif;
But, of course, SAS considers MEPE_ELIG_IND="Y" to be passing a value to the macro variable MEPE_ELIG_IND instead of a whole value for variable &condition.
Just wondered if anybody had ideas for this.
... View more