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 the function of output statement in a SAS Program?

1123


what is the use of proc sql? : Sas programming

1186


what is star schema? : Sas-di

1186


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

1120


What is a method for assigning first.VAR and last.VAR to the BY group variable on unsorted data?

2630


What are the new features included in the new version of SAS Programming Language?

1249


How substr function works in sas?

1272


How can you limit the variables written to output dataset in data step?

1376


Explain the use of proc print and proc contents?

1013


what are the component of range? : Sas-bi

1147


Differentiate input and infile.

1148


What does the trace option do?

1163


explain what is factor analysis? : Sas-administrator

1172


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

1140


What does the RUN statement do?

1349