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 the difference between order and group variable in proc report?

1116


How would you determine the number of missing or nonmissing values in computations?

830


Explain what is data step?

926


which date function advances a date, time or datetime value by a given interval? : Sas programming

791


How we can call macros with in data step? : sas-macro

820


What are the different servers in sas? : sas-grid-administration

822


what is change analysis in sas di ? : Sas-di

783


what is the limit of the number of the rows and columns available in the worksheet? : Sas-bi

847


What is the general format of function in sas? : sas-grid-administration

759


If you could design your ideal job, what would it look like?

2670


Enlist the functions performed by sas.

860


Name some categories in sas 9? : sas-grid-administration

731


Mention how to limit decimal places for the variable using proc means?

839


Describe the function and utility of the most difficult SAS macro that you have written?

2253


What is the difference between reading data from an external file and reading data from an existing data set?

890