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
Explain the difference between using drop = data set option in set and data statement?
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
Do you know the features of sas?
what do you mean by data staging area? : Sas-di
What are the data types does SAS contain?
Describe the ways in which you can create a macro variable?
What is the use of stop statement?
what is sas database server? : Sas-di
how does sas handle missing values in: assignment statements, functions, a merge, an update, sort order, formats, procs? : Sas programming
what is the use of sas management console? : Sas-di
What is the differnce between SDTM 3.1.2 to 3.1.1 version
What does proc print, and proc contents are used for?
What can be the size of largest dataset in SAS?
which date function advances a date, time or datetime value by a given interval? : Sas programming
What does the trace option do?