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...

calculate the sum of value using only DATA STEP.
data count_;
input year name $ value;
cards;
2006 xxx 10
2007 yyy 12
2006 xxx 20
2008 yyy 15
2007 xxx 15
;

out put should be like this
year name T_value
-----------------------
2006 xxx 30
2007 xxx 15
2007 yyy 12
2008 xxx 15

Answer Posted / nani

proc sort data=a;
by year ;
run;

data total ;
set a;
retain T_value;
by year ;
if first.year then T_value =0 ;
T_value + value;
if last.year then output ;
run;

proc print ;
run;

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is Linear Regression?

1168


what can you learn from the sas log when debugging? : Sas programming

1090


what is sas olap server? : Sas-di

1258


What is the differnce between SDTM 3.1.2 to 3.1.1 version

5077


what is program data vector? : Sas-administrator

1079


What are the functions which are used for character handling functions?

1146


What is the basic structure of a sas program?

1124


What are the uses of sas?

1277


Tell e how how dealt with..

2253


How do dates work in sas?

1146


How would you code a macro statement to produce information on the sas log? This statement can be coded anywhere? : sas-macro

1051


What is run-group processing?

1171


Do you need to know if there are any missing values?

1041


what is metadata? : Sas-bi

1032


Explain the difference between nodup and nodupkey options?

1030