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

Differentiate input and infile.

1072


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

949


What is the use of the %include statement?

1122


How can you create a macro variable with in data step? : sas-macro

1008


What is the SAS data set?

1103


why is a stop statement needed for the point=option on a set statement? : Sas programming

1052


explain what is data set in sas? : Sas-administrator

945


what is the difference between floor and ceil functions in sas? : Sas-administrator

1221


List down the reasons for choosing sas over other data analytics tools.

1235


Explain the difference between informat and format with an example.

1140


Can you execute a macro within a macro? Describe. : sas-macro

1081


What is the difference between order and group variable in proc report?

1395


State the difference between INFORMAT and FORMAT ?

1063


hi tell be about pfizer? how to compare the work with other companies ? please tell me how to login and work also?

2048


How might you use MOD and INT on numeric to mimic SUBSTR on character Strings?

1330