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
what is information maps?
What are the data types that sas contain?
How does the internal authentication work in sas? : sas-grid-administration
where to use sas business intelligence? : Sas-bi
explain the difference between proc means and proc summary?
what is metadata? : Sas-bi
what are some problems you might encounter in processing missing values? In data steps? Arithmetic? Comparisons? Functions? Classifying data? : Sas programming
What is SAS? What are the functions does it performs?
What was the last computer book you purchased? Why?
Describe crosslist option in tables statement?
how can you put a "trace" in your program? : Sas programming
How can you create a macro variable with in data step? : sas-macro
What is the role of unrestrictive users? : sas-grid-administration
what cause the "error: connect:" and "error in the libname statement" when there weren't any such problems?
What is substr function?