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?
@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.
At least in FedSQL functions avg and mean are the same:
@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.
@thanikondharish wrote:
is there any difference between average and mean value?
NO.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.