Hi:
Generally, folks don't pass whole IF statements in a %LET. Although it is possible to do, usually, you want to -do- something if a macro variable exists. Well, what is the thing you want to do?? Usually, it is some kind of conditional process, procedure or data step (or piece of data step program.)
I see that as one issue. Then there's the fact that you're passing an IF statement to a macro program and the IF statement will be hanging out in open code, unless you haven't shown the whole program. You can only use an IF statement inside a DATA step program. Don't confuse a data step IF with a macro logic %IF.
But, assuming that you haven't shown us all the code, and you are hiding a data step program someplace, I would expect to see a quoting function like %STR or %NRSTR being used to protect the IF statement snippet.
Even if you DO have a data step program, however, your PUT statement is incorrect. The FORMAT is missing a '.' -- it should be $INTFMT. (your syntax is missing the period. Also, the rest of your code will need to have the rest of the IF statement -- including the action to take on the TRUE and the closing semi-colon.
One rule of thumb for macro processing is to start with a working SAS program and then macro-ize the working program. I don't see that you have a working SAS program that can be macro-ized -- where is the rest of your IF statement going to be?? It seems to me that you want to do some kind of error checking -- which is a good thing, but I'd expect to see something like what's shown at the bottom of this posting -- I made up a program to show the difference between a macro %IF and a data step IF.
In my program, I show the %IF controllling whether an entire data step program would be run. Alternately, I could have coded the %IF -inside- the DATA step program, but generally error checking and issuing messages in the log is something that's done before a major process starts because if you don't have all of your macro variables with values, you might not want to go forward with the data step program.
cynthia
[pre]
%macro test(exlimitint);
%if &exlimitint= %then %do;
%put -------***** EXLIMITINT macro variable is null;
%end;
%else %if %upcase(&exlimitint) ne SEX %then %do;
%put -------***** You can only ask for the SEX variable;
%end;
%else %if %upcase(&exlimitint) eq SEX %then %do;
proc format;
value $intfmt 'M' = 'FMT VALUE'
'F' = 'XXXXXXXXX';
run;
data new;
set sashelp.class;
newvar = put(&exlimitint,$intfmt.);
if put(&exlimitint,$intfmt.)='FMT VALUE'
then output;
run;
ods listing;
proc print data=new noobs;
title 'Correct macro var and condition';
title2 "Value of EXLIMITINT macro var is: &EXLIMITINT";
run;
%end;
%mend test;
options nodate nonumber center;
** invoke with null;
%test()
** invoke with SEX (since program uses SASHELP.CLASS);
%test(sex)
** invoke with NAME -- not what program is coded for;
%test(name)
[/pre]