From: Franco82 on
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

From: Tom Abernathy on
On Mar 24, 2:48 pm, Franco82 <franco.mendo...(a)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?

From: Franco82 on
On Mar 24, 8:35 pm, Tom Abernathy <tom.aberna...(a)gmail.com> wrote:
> On Mar 24, 2:48 pm, Franco82 <franco.mendo...(a)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!