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 the function of output statement in a SAS Program?
what is the use of proc sql? : Sas programming
what is star schema? : Sas-di
if you were told to create many records from one record, show how you would do this using array and with proc transpose? : Sas programming
What is a method for assigning first.VAR and last.VAR to the BY group variable on unsorted data?
What are the new features included in the new version of SAS Programming Language?
How substr function works in sas?
How can you limit the variables written to output dataset in data step?
Explain the use of proc print and proc contents?
what are the component of range? : Sas-bi
Differentiate input and infile.
What does the trace option do?
explain what is factor analysis? : Sas-administrator
what is the use of sas management console? : Sas-di
What does the RUN statement do?