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 are the features of SAS?
In SAS explain which statement does not perform automatic conversions in comparisons?
Describe the ways in which you can create a macro variable?
Are you involved in writing the inferential analysis plan? Tables specifications?
What are the difference between the sas data step and sas procs?
Explain data step in SAS
What will calendar procedure do?
What commands are used in the case of including or excluding any specific variables in the data set?
Describe the ways in which you can create macro variables?
What are pdv and it functions?
How you are maintaining sas programmes in your company...any specific version control software you are using? If so, tell me the name?
What are the table names in oracle database...?
What is the maximum length of the macro variable?
What is the difference between INPUT and INFILE ?
Tell me more about the parameters in macro? : sas-macro