Can you calculate the mean, median and mode of the following data set
using data step logic? Don't use any function or procedure.
data a;
input age @@;
datalines;
22 32 32 32 43 23 24 56 45 54 28 29 27 26 25 28 30 20 18 37 36 47 46
56 19 20
;
run;
I have calculated the mean which i have posted in the answer section.
Answer Posted / paul
data b;
set a end=lastobs;
age_temp+age;
count+1;
if lastobs then
mean=age_temp/count;
if _n_=13 then
Median=Age; /*median is the mid value */
run;
proc sort data=b out=c;
by age;
run;
data d;
set c;
if first.age=0 and last.age=0 then
Mode=age;/*mode is the most repeated value*/
by age;
run;
| Is This Answer Correct ? | 3 Yes | 9 No |
Post New Answer View All Answers
What are the differences between sum function and using “+” operator?
What areas of SAS are you most interested in?
explain the difference between proc means and proc summary?
How does proc sql work?
what is the primary data source for the wrs? : Sas-bi
Do you need to know if there are any missing values?
What is the difference between class statement and by statement in proc means?
What are the applications primarily used by business analyst? : Sas-bi
Have you ever used the SAS Debugger?
Differentiate between sas functions and sas procedures.
how does sas handle missing values in formats? : Sas programming
how do you want missing values handled? : Sas programming
explain the proc in sas? : Sas-administrator
hi all, I need the SAS DI DUMP(A00 260) for attending the certification. if any one have, pls provide it.Please Email to vrpotluri@hotmail.com. Thanks - Ramana
Difference between SAS STATA & SPSS?