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


Please Help Members By Posting Answers For Below Questions

what is data integration? : Sas-di

608


What is substr function?

618


how will you location sas platform applications available from web browser? : Sas-bi

536


What are symget and symput? : sas-macro

722


What is your favorite all time computer book? Why?

2044






Describe the ways in which you can create macro variables? : sas-macro

574


what is null hypothesis? why do you consider that?

2413


What is the function of output statement in a SAS Program?

606


how to read the variables in sas? : Sas-administrator

547


What does P-value signify about the statistical data?

846


What are the implications?

1177


This entry was posted in General. Bookmark the permalink. Post a comment or leave

4017


explain about sas business intelligence? : Sas-bi

596


What is the order of application for output data set options, input data set options and SAS statements?

1076


What is the SAS data set?

671