LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (June 2005, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 3 Jun 2005 12:27:39 -0700
Reply-To:   Ryan Diver <ryandiver@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Ryan Diver <ryandiver@GMAIL.COM>
Organization:   http://groups.google.com
Subject:   macro variable will not evaluate as numeric
Comments:   To: sas-l@uga.edu
Content-Type:   text/plain; charset="iso-8859-1"

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.


Back to: Top of message | Previous page | Main SAS-L page