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

Give an example where SAS fails to convert character value to numeric value automatically?

1076


Difference between nodup and nodupkey options?

1182


what r the job openings SAS for fresher graduates !

2442


Describe a time when you were really stuck on a problem and how you solved it?

2544


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

1081


What are the difference between ceil and floor functions in sas?

1344


What versions of SAS have you used (on which platforms)?

1505


How will you use the WHO Drug Dictionary for Reporting Clinical Trials?

2330


what is sas data set?

1095


Do you need to compute new variables? If so,should you do this before you execute the report-writing procedure?

1908


What are common programming errors committed in sas

1137


What does the trace option do?

1100


What are symget and symput? : sas-macro

1303


Explain by-group processing?

994


what cause the "error: connect:" and "error in the libname statement" when there weren't any such problems?

2174