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
Explain the purpose of substr functions in sas programming.
What do the SAS log messages "numeric values have been converted to character" mean?
what do the sas log messages "numeric values have been converted to character" mean? : Sas programming
Explain input and put function?
what is star schema? : Sas-di
what other sas products have you used and consider yourself proficient in using? : Sas programming
what are validation tools that are used in sas? : Sas-administrator
how to debug and test the sas program? : Sas-administrator
what is PhaseIII, ODS, TLG, Macro and Proc in SAS
What are the differences between proc means and proc summary?
what is the purpose of _error_? : Sas programming
Describe a time when you were really stuck on a problem and how you solved it?
Can you explain the process of calendar?
How will you generate test data with no input data?
Define run-group processing?