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


Please Help Members By Posting Answers For Below Questions

What is the difference between the proc sql and data step?

674


What is the role of sas grid administrator? : sas-grid-administration

841


What is the use of PROC gplot?

646


what r the job openings SAS for fresher graduates !

2021


What is program data vector (pdv) and what are its functions?

635






what is transformation in sas data integration? : Sas-di

566


Hi all, If Anybody has Advance SAS Certification dumps??? Please share with me. Email: pramod.kalugade03@gmail.com

1595


Hi, Does anybody has lastest SAS certification(base, adv., clinical)dumps,if anybody has please email me at mailtorajani76@gmail.com. Thanks

1808


Explain the use of proc print and proc contents?

565


Mention what is the difference between nodupkey and nodup options?

604


Where do you use proc means over proc freq?

572


How to convert a numeric variable to a character variable?

638


Explain what Proc glm does?

645


What is proc sort?

726


what are some problems you might encounter in processing missing values? In data steps? Arithmetic? Comparisons? Functions? Classifying data? : Sas programming

743