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
hi all, I need the SAS DI DUMP(A00 260) for attending the certification. if any one have, pls provide it.Please Email to vrpotluri@hotmail.com. Thanks - Ramana
What is the difference between one to one merge and match merge? Give an example.
How will you react when, while consulting a SAS documentation manual to get an answer to a problem, someone says hey, I thought you were supposed to know all that stuff already, and not have to look it up in a book?
What is program data vector (pdv)?
If money were no object, what would you like to do?
Difference between informat and format?
Name and describe few sas character functions that are used for data cleaning in brief.
Explain the use of proc print and proc contents?
What is a method to debug and test your SAS program?
I have a dataset concat having variable a b & c. How to rename a b to e & f?
What are the features of SAS?
Differentiate between format and informat? : sas-grid-administration
Give some ways by which you can define the variables to produce the summary report (using proc report)?
What is the basic structure of a sas program?
why is sas data integration studio important? : Sas-di