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 the difference between infile and input? : Sas-administrator
How to import multiple xls files into sas. Out of those files, how to get different values from a single variable and how to find number of rows per value type? We can do this using group by for one xls file with proc sql. Was wondering how I can achieve this for multiple files at the same time. Any ideas?
for whom is sas data integration studio designed? : Sas-di
Mention what is PROC in SAS?
What is the difference between %put and symbolgen? : sas-macro
what cause the "error: connect:" and "error in the libname statement" when there weren't any such problems?
How would you identify a macro variable? : sas-macro
why is sas data integration studio important? : Sas-di
explain about various caches available in data integrator? : Sas-di
Differences between where and if statement?
If you were told to create many records from one record, show how you would do this using array and with proc transpose?
what are the best practices to process the large data sets in sas programming? : Sas-administrator
Did you used proc test? when?
WHAT IS SAS WEB SERVICE and what are the steps to create an xml service ?
Explain proc sort?