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

Why and when do you use proc sql?

1181


Mention what are the data types does SAS contain?

1092


Are you involved in writing the inferential analysis plan? Tables specfications?

2507


How does SAS handle missing values in: assignment statements, functions, a merge, an update, sort order, formats, PROCs?

1478


Differentiate between ceil and floor functions.

1102


how do you debug and test your sas programs? : Sas programming

1069


What is the difference between INPUT and INFILE ?

1240


what are validation tools that are used in sas? : Sas-administrator

1001


what is a method for assigning first.var and last.var to the by groupvariable on unsorted data? : Sas programming

960


What are the different operating system platforms in which we can use sas? : sas-grid-administration

1009


data data1; input dt account; format dt date9.; cards; 1745 1230 1756 1120 1788 1130 1767 1240 ; data data2; input startdt enddt total; format startdt date9. enddt date9.; cards; 1657 1834 12300 1557 1758 16800 1789 1789 12300 1788 1345 12383 1899 1899 13250 ; proc sql; create table data3 as select * from data1 as x left join data2 as y on x.dt>=y.startdt and x.dt<=y.enddt; quit; Here, we are getting cartision product. But,I want left join report consisting of this program. It should not get duplicate values. you can modify the program also.

2163


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

944


What does the trace option do?

1054


What are the applications primarily used by business analyst? : Sas-bi

941


Do you need to know if there are any missing values?

993