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


Please Help Members By Posting Answers For Below Questions

List out some key concept of SAS

805


Describe what are the different levels of administrative users in sas? : sas-grid-administration

785


why is a stop statement needed for the point=option on a set statement? : Sas programming

813


How long can a macro variable be? A token? : sas-macro

928


How do you delete duplicate observations in sas?

795


What are the differences between proc means and proc summary?

797


If a variable contains only numbers, can it be a character data type?

837


what is the difference between infile and input? : Sas-administrator

837


do you need to know if there are any missing values? : Sas programming

756


In sas admin differentiate between roles and capabilities? : sas-grid-administration

758


Explain what is data step?

924


how does sas handle missing values in formats? : Sas programming

829


what is SAS OPTIMIZATION?

2029


what is data governance? : Sas-di

786


What are the 3 components in sas programming?

924