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 one to one merge and match merge? Give an example.
Assuming {et} is randomly drawn from N(0,1) and e0 = 0, generate 200 observations of xt = et − 0.5e(t−1) and draw a line graph of xt.
Do you need to compute new variables? If so,should you do this before you execute the report-writing procedure?
if the Id has more then two transcatiion then show the first observation, IF Id has only two observation then It show both the observation
What are the default statistics for means procedure?
Describe 5 ways to do a “table lookup” in SAS?
what are the considerations when picking a SAS/STAT procedure?
what do the sas log messages "numeric values have been converted to character" mean? What are the implications? : Sas programming
What is the maximum length of the macro variable? : sas-macro
How to convert a numeric variable to a character variable?
What are the differences between proc means and proc summary?
If you could design your ideal job, what would it look like?
what is business intelligence? : Sas-bi
How would you define the end of a macro?
What is the use of divide function?