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 factor analysis?
How does the internal authentication work in sas? : sas-grid-administration
what is the difference between nodup and nodupkey options? : Sas programming
Difference between sum function and using “+” operator?
What do the PUT and INPUT functions do?
How can sas program be validated?
Difference between informat and format?
how will you locate the sas platform applications? : Sas-bi
describe about physical data integration? : Sas-di
What is your favorite all time computer book? Why?
What makes sas stand out to be the best over other data analytics tools?
hi all, I need the SAS DI DUMP(A00 260) for attending the certification. if any one have, pls provide it.Please Email to vrpotluri@hotmail.com. Thanks - Ramana
how to create the AE dataset by using SDTMIG specifications and SAP plan by using UNIX platform?
how would you determine the number of missing or nonmissing values in computations? : Sas programming
What are the differences between sum function and using “+” operator?