Date: Thu, 25 Mar 2010 12:23:37 -0700
Reply-To: Franco82 <franco.mendolia@GMX.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Franco82 <franco.mendolia@GMX.DE>
Subject: Re: PROC SQL: Concatenating values of several columns into
several macro variables
Content-Type: text/plain; charset=ISO-8859-1
On Mar 24, 8:35 pm, Tom Abernathy <tom.aberna...@gmail.com> wrote:
> On Mar 24, 2:48 pm, Franco82 <franco.mendo...@gmx.de> wrote:
> > Hello!
> > I am using a proc sql statement like the one given below, which works
> > fine:
> > proc sql;
> > select sum(z1),sum(z2),sum(z3) into :s1 separated by ' ', :s2
> > separated by ' ', :s3 separated by ' '
> > from dataset
> > where event = 1
> > group by time;
> > quit;
> > What I want is that instead of having to specify for each variable "
> > separated by ' ' ", I would like to have something like
> > select sum(z1),sum(z2),sum(z3) into :s1-:s3 separated by ' '
> > since in general I have much more than 3 variables. However, that
> > statement does not work. Any ideas?
> > Thanks,
> > Franco
> Someone posted a cleverly little %FOR macro for generating code like
> that fairly easily.
> I am curious why if you have that many values you putting them into
> macro variables? Why not just put them in a dataset?
> Also why are you using SQL to do the work of PROC SUMMARY?
I didn't even consider proc summary, thanks for the hint!