Statistical Procedures

Programming the statistical procedures from SAS
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
amager
Obsidian | Level 7

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Run it and checking is faster than waiting for a response. 

View solution in original post

4 REPLIES 4
amager
Obsidian | Level 7
any suggestion
Astounding
PROC Star

What is _ORGA?

 

If you want the sum of all variables, as part of the OUTPUT statement remove the parentheses and use:

 

sum=

Reeza
Super User

Run it and checking is faster than waiting for a response. 

ballardw
Super User

@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.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 36762 views
  • 1 like
  • 4 in conversation