|
sum(a,0)
On Fri, Jun 10, 2011 at 3:26 PM, Bolotin Yevgeniy
<YBolotin@schools.nyc.gov> wrote:
> The SUM function (and probably other aggregate functions) in PROC SQL
> change from row-level to column-level based on context
>
>
> Is it possible to force it to be one vs the other?
>
> (as a thought experiment: I want to get a row-level sum of non-missing
> values, but the variable list is a dynamically generated macro parameter
> and may only have one variable in it)
>
>
> Sample data demonstrating this is below.
> for a fun time, call sum(sum(a,b,c))!
>
>
>
> data _z;
> input a b c;
> datalines;
> 1 2 3
> 4 . 6
> ;
> run;
>
> proc sql;
> select
> sum(a,b,c) as sum_row,
> sum(a) as sum_col
> from _z
> ;
> quit;
>
>
> /*
> Output
> sum_row sum_col
> -------------------
> 6 5
> 10 5
> */
>
|