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 / ravikumar

Answer:

data new;
set a end = last;
count+1;
age_n+age;
if last then do;
mean = round(((age_n)/(count)),.8);
median = ((count+1)/2);
end;
run;

By the above program we can calculate the mean and median.
lets us know me, if anybody find the logic for find mode

Is This Answer Correct ?    0 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is information maps?

1616


What are the data types that sas contain?

655


How does the internal authentication work in sas? : sas-grid-administration

583


where to use sas business intelligence? : Sas-bi

582


explain the difference between proc means and proc summary?

672






what is metadata? : Sas-bi

600


what are some problems you might encounter in processing missing values? In data steps? Arithmetic? Comparisons? Functions? Classifying data? : Sas programming

728


What is SAS? What are the functions does it performs?

735


What was the last computer book you purchased? Why?

1912


Describe crosslist option in tables statement?

712


how can you put a "trace" in your program? : Sas programming

578


How can you create a macro variable with in data step? : sas-macro

573


What is the role of unrestrictive users? : sas-grid-administration

571


what cause the "error: connect:" and "error in the libname statement" when there weren't any such problems?

1683


What is substr function?

626