Date: Wed, 1 Apr 2009 10:53:24 -0400
Reply-To: Kevin Viel <citam.sasl@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Kevin Viel <citam.sasl@GMAIL.COM>
Subject: Re: proc sql and catx question
Content-Type: text/plain; charset=ISO-8859-1
On Wed, 1 Apr 2009 10:26:55 -0400, D T <sasandstats@LIVE.COM> wrote:
>I am not familiar with using catx in proc sql and have been
>trying to work out if I could put a line of code into a catx statement.
This
>is, in words, what I am trying to do:
>
>
>
>if my q19 value in table a is the same as one of the values
>in my variable descr in table b, use the value stored in table b in the
>variable vname to set the variable with the same name in table a to 1,
and set
>a variable called flag19 to 1.
>
>
>
>I may be trying something way too complicated. I have not
>seen an example that uses two tables in a catx statement, but I have also
not found
>many examples of catx in proc sql. I am already failing to just get the
comparison
>of values correctly, e.g., for this part:
>
>'if',a.q19, '="',b.descr,'"',
>
>
>
>Here is what I have�and it is far from working �:
>
>proc
>sql;
>
>select
>catx('','if',a.q19, '="',b.descr,'"',
>'then do;',a.vname,'="1";
>flag1=1;','end;')
>into :q1list separated by
>' '
>
>from
>commentmg as b, testing as a;
>
>quit;
Are you not getting the Cartesian result? A sample of the data and the
goal might help. Where is Q1LIST going to be used? You might consider
using IN:
if variable in ( )
-Kevin
|