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 difference between the proc sql and data step?
What is the role of sas grid administrator? : sas-grid-administration
What is the use of PROC gplot?
what r the job openings SAS for fresher graduates !
What is program data vector (pdv) and what are its functions?
what is transformation in sas data integration? : Sas-di
Hi all, If Anybody has Advance SAS Certification dumps??? Please share with me. Email: pramod.kalugade03@gmail.com
Hi, Does anybody has lastest SAS certification(base, adv., clinical)dumps,if anybody has please email me at mailtorajani76@gmail.com. Thanks
Explain the use of proc print and proc contents?
Mention what is the difference between nodupkey and nodup options?
Where do you use proc means over proc freq?
How to convert a numeric variable to a character variable?
Explain what Proc glm does?
What is proc sort?
what are some problems you might encounter in processing missing values? In data steps? Arithmetic? Comparisons? Functions? Classifying data? : Sas programming