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

if you were told to create many records from one record, show how you would do this using array and with proc transpose? : Sas programming

999


Can you execute macro within another macro? If so, how would sas know where the current macro ended and the new one began? : sas-macro

1129


How do you control the number of observations and/or variables read or written?

1189


how to remove duplicates using proc sql?

1088


Enlist the syntax rules followed in sas statements.

1027


What are the data types that sas contain?

1118


how will you location sas platform applications available from web browser? : Sas-bi

1010


How to create an external dataset with sas code?

1067


what is the purpose of _error_? : Sas programming

1072


What are the different operating system platforms in which we can use sas? : sas-grid-administration

1007


Which command is used to save logs in the external file?

1024


what is metadata? : Sas-bi

964


What will calendar procedure do?

1016


What is the maximum length of the macro variable? : sas-macro

1043


what is sas olap server? : Sas-di

1186