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
what is metadata? : Sas-bi
How can you limit the variables written to output dataset in data step?
What are the table names in oracle database...?
Differentiate between format and informat? : sas-grid-administration
What is the work of tranwrd function?
which date functions advances a date time or date/time value by a given interval? : Sas programming
How do you convert basic cube to transaction cube and transaction cube to basic cube?
how will you locate the sas platform applications? : Sas-bi
What is SAS informats?
How to create an external dataset with sas code?
What are the differences between proc means and proc summary?
how sas deals with business intelligence? : Sas-bi
Mention the difference between ceil and floor functions in sas?
Name validation tools used in SAS
What is by-group processing?