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

what is metadata? : Sas-bi

1074


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

1375


What are the table names in oracle database...?

2796


Differentiate between format and informat? : sas-grid-administration

1120


What is the work of tranwrd function?

1297


which date functions advances a date time or date/time value by a given interval? : Sas programming

1006


How do you convert basic cube to transaction cube and transaction cube to basic cube?

2287


how will you locate the sas platform applications? : Sas-bi

1083


What is SAS informats?

1162


How to create an external dataset with sas code?

1244


What are the differences between proc means and proc summary?

1195


how sas deals with business intelligence? : Sas-bi

1102


Mention the difference between ceil and floor functions in sas?

1208


Name validation tools used in SAS

1220


What is by-group processing?

1056