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
|
|
0
|
|
|
|
Reply
|
franco.mendolia (1)
|
3/24/2010 6:48:10 PM |
|
On Mar 24, 2:48=A0pm, Franco82 <franco.mendo...@gmx.de> wrote:
> Hello!
>
> I am using a proc sql statement like the one given below, which works
> fine:
>
> =A0 proc sql;
> =A0 =A0 select sum(z1),sum(z2),sum(z3) into =A0:s1 separated by ' ', :s2
> separated by ' ', :s3 separated by ' '
> =A0 =A0 from dataset
> =A0 =A0 where event =3D 1
> =A0 =A0 group by time;
> =A0 quit;
>
> What I want is that instead of having to specify for each variable "
> separated by ' ' ", I would like to have something like
>
> =A0 =A0 select sum(z1),sum(z2),sum(z3) into =A0: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?
|
|
0
|
|
|
|
Reply
|
Tom
|
3/25/2010 1:35:17 AM
|
|
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!
|
|
0
|
|
|
|
Reply
|
Franco82
|
3/25/2010 7:23:37 PM
|
|
|
2 Replies
1413 Views
(page loaded in 0.065 seconds)
|