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

Explain the difference between using drop = data set option in set and data statement?

1118


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

1017


Do you know the features of sas?

1000


what do you mean by data staging area? : Sas-di

1079


What are the data types does SAS contain?

1060


Describe the ways in which you can create a macro variable?

1044


What is the use of stop statement?

1023


what is sas database server? : Sas-di

1064


how does sas handle missing values in: assignment statements, functions, a merge, an update, sort order, formats, procs? : Sas programming

992


what is the use of sas management console? : Sas-di

1045


What is the differnce between SDTM 3.1.2 to 3.1.1 version

5035


What does proc print, and proc contents are used for?

1069


What can be the size of largest dataset in SAS?

1182


which date function advances a date, time or datetime value by a given interval? : Sas programming

1005


What does the trace option do?

1060