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

Hi, If anyone has base SAS certification dumps, please share.

1599


What is the use of the %include statement?

887


Give some examples where proc report’s defaults are same as proc print’s defaults?

873


What is a macro routine?

2326


What are the ways in which macro variables can be created in sas programming?

774


what is the basic structure sas administrator? : Sas-administrator

772


How do you delete duplicate observations in sas?

796


what is broad cast agent? : Sas-bi

812


What are types of transport files?

7351


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

1808


what is sas application server, database server, sas olap server and sas metadata server? : Sas-di

756


Describe the function and untility of the most difficult SAS macro that you have written.

1831


explain about various caches available in data integrator? : Sas-di

789


For what purpose would you use the RETAIN statement?

1256


How do you connect the desktop application to metadata server? : sas-grid-administration

834