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
what is enterprise guide? What is the use of it? : Sas programming
How do you convert basic cube to transaction cube and transaction cube to basic cube?
Explain bmdp procedure?
how to generate the test data in sas without input data? : Sas-administrator
what is the Population you used in your project, is it ITT or PP?
What is the use of function Proc summary?
What is connection profile? : sas-grid-administration
I have a SCD Type 2 Dimention for Location In which A Sales Office in Having two Surrogate Keys just because of the change in it's Sales Group. SKey SalesGroup Sales Office BeginDate EndDate 280 SG1 SO1 01APR2000 01APR2010 281 SG2 SO1 02APR2010 31MAR2999 Now while loading the Fact, the Lookup ir returning SKey 280 for records before and after 01APR2010. I am not able to give WHERE condition in the Lookup Properties (TranDate between BeginDate and EndDate). Please help.
what is intially documentation in sas?
which features do you use to check the data validations and errors? : Sas-administrator
what do you mean by data staging area? : Sas-di
what is sas application server? : Sas-di
How can I remove header from output data set?
What are the new features included in the new version of SAS Programming Language?
Have you ever used the SAS Debugger?