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 order and group variable in proc report?
How would you determine the number of missing or nonmissing values in computations?
Explain what is data step?
which date function advances a date, time or datetime value by a given interval? : Sas programming
How we can call macros with in data step? : sas-macro
What are the different servers in sas? : sas-grid-administration
what is change analysis in sas di ? : Sas-di
what is the limit of the number of the rows and columns available in the worksheet? : Sas-bi
What is the general format of function in sas? : sas-grid-administration
If you could design your ideal job, what would it look like?
Enlist the functions performed by sas.
Name some categories in sas 9? : sas-grid-administration
Mention how to limit decimal places for the variable using proc means?
Describe the function and utility of the most difficult SAS macro that you have written?
What is the difference between reading data from an external file and reading data from an existing data set?