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

options firstobs=1 obs=26;
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;

proc sort data=a out=ab;
by age;
run;

options firstobs=13 obs=14;
data c;
set ab end=last;
sum_age+age;
if last then median=sum_age/2;
run;

we need observation 13 and 14 because total number of observations is n=26 when n is even we need to do mean of two observations n/2 and (n/2)+1 which is 13th and 14 th observations in this case.
let me know if you need more help... I'm still thinking about mode...will send once I get it

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

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

1589


what is the difference between calculating the 'mean' using the mean function and proc means? : Sas programming

1207


How will you generate test data with no input data?

1132


How do you control the number of observations and/or variables read or written? Approximately what date is represented by the SAS date value of 730?

1645


What is proc sort?

1167


Give e an example of..

2301


how can you import .csv file in to sas? : Sas programming

1069


how would you create multiple observations from a single observation? : Sas programming

973


what are validation tools that are used in sas? : Sas-administrator

1028


what is sas database server? : Sas-di

1082


how to debug and test the sas program? : Sas-administrator

1005


What do you code to create a macro? : sas-macro

1091


Mention what are the data types does SAS contain?

1113


Which command is used to perform sorting in sas program?

1018


How would you identify a macro variable? : sas-macro

989