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 / aaa
PROC SORT DATA=COUNT_;
BY YEAR NAME;
RUN;
DATA TEST (DROP=VALUE);
SET COUNT_;
BY YEAR NAME;
RETAIN COUNT;
IF FIRST.NAME THEN COUNT = 0;
COUNT = COUNT + VALUE;
IF LAST.NAME THEN OUTPUT;
RUN;
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
what is scheduling and how will u implement it. In scheduling 5 jobs r running if there is an error occured at 3rd job and how will u check and waht necessary steps will u take not to repeat the same mistake
What are the default statistics that proc means produce?
what are the softwares and applications that are used most frequently used by sas bi applications developers? : Sas-bi
which date function advances a date, time or datetime value by a given interval? : Sas programming
What are the differences between sum function and using “+” operator?
What is the purpose of trailing @ and @@? How do you use them?
What does proc print, and proc contents are used for?
how do you test for missing values? : Sas programming
How to test the debugging in sas?
What is PROC in SAS?
Name few SAS functions?
What are the data types does SAS contain?
Why and when do you use proc sql?
What do the put and input function do?
what are the best practices to process the large data sets in sas programming? : Sas-administrator