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 work of tranwrd function?
What is your favorite all time computer book? Why?
Hi, Does anybody has lastest SAS certification(base, adv., clinical)dumps,if anybody has please email me at mailtorajani76@gmail.com. Thanks
How sas treats the dsd delimiters?
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 are the considerations when picking a SAS/STAT procedure?
How would you define the end of a macro? : sas-macro
For clinical entire study how many tables will create approx?
Explain input and put function?
What is the difference between input and infile statement?
What is the difference between reading data from an external file and reading data from an existing data set?
Name validation tools used in SAS
What are the data types that sas contain?
explain about various caches available in data integrator? : Sas-di
Explain the use of proc gplot? : sas-grid-administration