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


Please Help Members By Posting Answers For Below Questions

Explain the purpose of substr functions in sas programming.

565


What do the SAS log messages "numeric values have been converted to character" mean?

890


what do the sas log messages "numeric values have been converted to character" mean? : Sas programming

541


Explain input and put function?

647


what is star schema? : Sas-di

647






what other sas products have you used and consider yourself proficient in using? : Sas programming

684


what are validation tools that are used in sas? : Sas-administrator

593


how to debug and test the sas program? : Sas-administrator

572


what is PhaseIII, ODS, TLG, Macro and Proc in SAS

3907


What are the differences between proc means and proc summary?

602


what is the purpose of _error_? : Sas programming

612


Describe a time when you were really stuck on a problem and how you solved it?

2205


Can you explain the process of calendar?

640


How will you generate test data with no input data?

563


Define run-group processing?

581