Date: Thu, 1 May 2003 11:38:36 -0700
Reply-To: j erickson <dguinn@TRISTATEGT.ORG>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: j erickson <dguinn@TRISTATEGT.ORG>
Organization: http://groups.google.com/
Subject: proc sql and many variable names
Content-Type: text/plain; charset=ISO-8859-1
I am considering converting some sas data step code to sql. I have the
following snippet of code that I believe is difficult to translate
into sql given that i have many var names and need to reference the
var names using array elements. If SQL allowed arrays this may not be
so difficult.
Is there a way to get SQL to reference specific variable names without
typing them into an editor. (I have looked at creating a macro
variable with the "into:" option, which gives me the values of each
variable as a line of text, but i could not reference the individual
elements in the macro).
(There are more arrays of variable names in this data step which I
have not included in the code snippet. )
data a ;
set def.&memb.4cast ;
by year ;
array customer(*) residc seasoc irrigc xxlarc ddlarc
streec public resrec resotc dummy1 ;
array use(*) residu seasou irrigu xxlaru ddlaru
streeu publiu resreu resotu dummy2 ;
array energy(*) reside seasoe irrige xxlare ddlare
streee publie resree resote officu ;
drop dummy1 dummy2 ;
date = mdy(1,1,year);
if year ge &prsyr then do;
do i=1 to 10;
if energy[i] ne . and use[i] ne . then do;
if energy[i]*use[i] ne 0 then do;
energy[I]=.;
use[I]=.;
end;
end;
end;