|
I'm new to macro coding and I'm trying to create a macro that will give
me a 1/0 variable for every combination of two variables. The macro
runs with out error messages, but all of the variables only have values
of 0. It doesn't look like the condition for assigning a 1 is being
met, but I can't figure out why. Any suggestions on the following code
would be helpful.
%MACRO INTX(MAIN=&MAIN,MAINCAT=&MAIN,MAINDES=&MAINDES,
INT=&INT,INTCAT=&INTCAT,INTDES=&INTDES);
DATA TEMP;
SET ONE;
**CREATE INTERACTION TERMS***;
%DO I=1 %TO &INTCAT.;
%DO J=1 %TO &MAINCAT.;
%IF &INT=&I AND &MAIN=&J %THEN
%STR(&INTDES.&I.&MAINDES.&J. = 1;);
%ELSE %STR(&INTDES.&I.&MAINDES.&J. = 0;);
%END;
%END;
RUN;
%MEND INTX;
%INTX(MAIN=LFDAIRGC,MAINCAT=5,MAINDES=LFD,
INT=CURRMULT,INTCAT=2,INTDES=MVT)
In this case LFDAIRGC is a numeric variable with values 1 to 5
and CURRMULT is a numeric variable with values 1 to 2.
|