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 / rpd

I can give logic part, rest kindly manage :)

step 1:proc sort the dataset by "PID YEAR"
step2 :in the datastep "SET" it using by PID YEAR
create a temp variable say _SUM and RETAIN _SUM,
reset _SUM=0 on FIRST.YEAR.
T_VALUE=_SUM+VALUE

I guess this will work

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Describe the function and untility of the most difficult SAS macro that you have written.

2219


what are the scrubbing procedures in sas? : Sas programming

1286


What is Linear Regression?

1165


What is data _null_?

1145


What is the SAS data set?

1131


What is the difference between INPUT and INFILE ?

1323


For what purposes have you used sas macros? : sas-macro

1001


what is program data vector? : Sas-administrator

1076


Enlist the functions performed by sas.

1128


What is a put statement?

1200


what are the component of range? : Sas-bi

1100


If you have a dataset that contains 100 variables, but you need only five of those, what is the code to force SAS to use only those variables?

1165


which features do you use to check the data validations and errors? : Sas-administrator

1056


What is the maximum and minimum length of macro variable

1254


how could you generate test data with no input data? : Sas programming

1189