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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.