LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (April 2012, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 9 Apr 2012 13:40:48 -0700
Reply-To:     Mike Temp <mwc500s@yahoo.com>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Mike Temp <mwc500s@YAHOO.COM>
Content-Type: text/plain; charset=iso-8859-1

I'm trying to use SQL to create a list of macro variables that can then be used in an IF/THEN statement.   This is a large panel dateset where each observation represents a firm and quarter. Each firm has an id, but this might have changed over time. When it changes, the prior id is recorded as pid. The goal is to create a new id that is the same over the entire time frame. My code is below.   When I run this code, the &&a&i and &&b&i will not resolve. I've seen a number of papers that discuss using SQL and macros this way, but not with an IF/THEN statement. I'd appreciate any insight into why this will not execute properly.   Thanks.   Mike     proc  proc into:b1 - :b29866frompred;  %macrop;    %doi=1%to29866;        if id=&&a&i then id2=&&b&i;    %end;%mend  datapred; setpred;%p;  run;;sqlnoprint;selectpidsqlnoprint;selectidinto:a1 - :a29866frompred;


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