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

how to generate the test data in sas without input data? : Sas-administrator

1067


What is program data vector (pdv) and what are its functions?

1162


what is the one statement to set the criteria of data that can be coded in any step? : Sas programming

1101


What is the purpose of trailing @ and @@? How do you use them?

999


What is the difference between the proc sql and data step?

1118


Explain the main difference between the sas procedures and functions? : Sas-administrator

1025


how to remove duplicates using proc sql?

1103


what are the types of interactive display types? : Sas-bi

1045


explain the use of % includes a statement in sas? : Sas-administrator

956


how to do user inputs and command line arguments in sas?

2988


Which statement does not perform automatic conversions in comparisons?

1717


Explain data_null_?

1009


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

1013


Hi all, If Anybody has Advance SAS Certification dumps??? Please share with me. Email: pramod.kalugade03@gmail.com

1982


what is star schema? : Sas-di

1087