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 / ravi s

it need two steps

step 1 : proc sort; by year name;run;

Step 2: data total (drop = value);
set count_;
by year name;
if first.name then T_value =0 ;
T_value + value;
if last.name then output ;
run;

Note: Hence i am doing work in data step. i need to sort
the data first by using "Proc Sort".

Kindly let me know is the any other method to do?

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

explain about various caches available in data integrator? : Sas-di

1111


Name validation tools used in SAS

1220


what does the run statement do? : Sas programming

1102


what are 5 ways to perform a table lookup in sas? : Sas-administrator

1296


In sas admin differentiate between roles and capabilities? : sas-grid-administration

1051


WHAT IS SAS WEB SERVICE and what are the steps to create an xml service ?

2839


How do you connect the desktop application to metadata server? : sas-grid-administration

1147


what is the use of proc contents and proc print in sas? : Sas-administrator

1103


In SAS explain which statement does not perform automatic conversions in comparisons?

1369


Mention what is SAS data set?

1177


Name types of category in which SAS Informats are placed?

1196


How many data types are there in SAS?

1130


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

1006


if a variable contain dates like "2015/01"---"2015/12" (yymm) ,How to add day to those dates,if them month is jan then 31 if the month is feb then 28 so on ...

1445


To what type of programms have you used scratch macros?

2607