Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 / paul

data b;
set a end=lastobs;
age_temp+age;
count+1;
if lastobs then
mean=age_temp/count;
if _n_=13 then
Median=Age; /*median is the mid value */
run;
proc sort data=b out=c;
by age;
run;
data d;
set c;
if first.age=0 and last.age=0 then
Mode=age;/*mode is the most repeated value*/
by age;
run;

Is This Answer Correct ?    3 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How would you define the end of a macro?

1083


Mention what is PROC in SAS?

1055


what is the purpose of _error_? : Sas programming

1124


what cause the "error: connect:" and "error in the libname statement" when there weren't any such problems?

2174


Mention sas system options to debug sas macros.

1163


do you prefer proc report or proc tabulate? Why? : Sas programming

973


what is sas application server? : Sas-di

1064


Which function is used to count the number of intervals between two sas dates?

1122


how does sas handle missing values in functions? : Sas programming

1196


how can you put a "trace" in your program? : Sas programming

1050


I need level 2 to 5 sas using companies in india

2377


What is the difference between SAS functions and procedures?

1144


what is data integration? : Sas-di

1108


What do you understand by the term Normal Distribution?

979


explain about sas business intelligence? : Sas-bi

1132