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

What are the implications?

1629


what is function of retain statment

1978


How would you identify a macro variable?

1032


what is metadata? : Sas-bi

971


What do the sas log messages “numeric values have been converted to character” mean? What are the implications?

1141


what are the best practices to process the large data sets in sas programming? : Sas-administrator

962


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

1047


What is factor analysis?

1079


Explain what is SAS informats?

1042


How to create list output for cross-tabulations in proc freq?

1064


How do you convert basic cube to transaction cube and transaction cube to basic cube?

2188


Which date function advances a date, time or datetime value by a given interval?

1082


In sas, what are the areas that you are most interested in? : sas-grid-administration

1025


Give e an example of..

2038


Explain the main difference between the sas procedures and functions? : Sas-administrator

1015