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 / nani
proc sort data=a;
by year ;
run;
data total ;
set a;
retain T_value;
by year ;
if first.year then T_value =0 ;
T_value + value;
if last.year then output ;
run;
proc print ;
run;
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is Linear Regression?
what can you learn from the sas log when debugging? : Sas programming
what is sas olap server? : Sas-di
What is the differnce between SDTM 3.1.2 to 3.1.1 version
what is program data vector? : Sas-administrator
What are the functions which are used for character handling functions?
What is the basic structure of a sas program?
What are the uses of sas?
Tell e how how dealt with..
How do dates work in sas?
How would you code a macro statement to produce information on the sas log? This statement can be coded anywhere? : sas-macro
What is run-group processing?
Do you need to know if there are any missing values?
what is metadata? : Sas-bi
Explain the difference between nodup and nodupkey options?