BookmarkSubscribeRSS Feed
thanikondharish
Calcite | Level 5

data s ;
input a1-a3 ;
cards ;
5 10 5
10 20 10
;

proc sql ;
select avg(a1) as average from s ;
quit;

or 

proc sql ;
select avg(of a1-a3) as average from s ;
quit;

 

by using proc sql i got average either column wise or row wise .

how to calculate average in datastep block?

5 REPLIES 5
andreas_lds
Jade | Level 19

@thanikondharish wrote:

data s ;
input a1-a3 ;
cards ;
5 10 5
10 20 10
;

proc sql ;
select avg(a1) as average from s ;
quit;

or 

proc sql ;
select avg(of a1-a3) as average from s ;
quit;

 

by using proc sql i got average either column wise or row wise .

how to calculate average in datastep block?


The syntax for calculating row-wise average is not that different from the proc sql code. If you need to calculate column-wise average, using proc summary is most-times more efficient.

thanikondharish
Calcite | Level 5
proc summary gives mean value.

there is difference between average and mean value i think so.
is there any difference between average and mean value?
andreas_lds
Jade | Level 19

At least in FedSQL functions avg and mean are the same:

avg_function.PNG

 

ballardw
Super User

@thanikondharish wrote:
proc summary gives mean value.

there is difference between average and mean value i think so.
is there any difference between average and mean value?

Only difference in general is spelling and how pedantic some users may be for vocabulary choices. Some uses of "average" have an interpretation of "typical" but in calculations average=mean for SAS. Of course "mean" can be used for "unkind".

 

Unless you are discussing  geometric mean compared to arithmetic mean.

Reeza
Super User

@thanikondharish wrote:


is there any difference between average and mean value?

NO. 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 5712 views
  • 2 likes
  • 4 in conversation