- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone,
I want to summarize all variables and to calulate mean juste for one variable x. my proc summary is it correct ?
proc summary data=table_tosum ;
var &variables_to_sum.;
by DD DF;
id a b c d &other_variables. ;
output out=table (drop= _TYPE_ _FREQ_ _ORGA ) sum()= mean(x)=;
run;
thanks.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Run it and checking is faster than waiting for a response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What is _ORGA?
If you want the sum of all variables, as part of the OUTPUT statement remove the parentheses and use:
sum=
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Run it and checking is faster than waiting for a response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@amager wrote:
Hi everyone,
I want to summarize all variables and to calulate mean juste for one variable x. my proc summary is it correct ?
proc summary data=table_tosum ; var &variables_to_sum.; by DD DF; id a b c d &other_variables. ; output out=table (drop= _TYPE_ _FREQ_ _ORGA ) sum()= mean(x)=; run;
thanks.
Placing the fixed name of a variable into one position of code such as mean(x) when that variable is not explicitly listed on the var statement is a likely point of code failure in the future when the macro variable &variables_to_sum does not contain x.