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 work of tranwrd function?

668


What is your favorite all time computer book? Why?

2050


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

1800


How sas treats the dsd delimiters?

724


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

547






what are the considerations when picking a SAS/STAT procedure?

2899


How would you define the end of a macro? : sas-macro

612


For clinical entire study how many tables will create approx?

1520


Explain input and put function?

647


What is the difference between input and infile statement?

684


What is the difference between reading data from an external file and reading data from an existing data set?

636


Name validation tools used in SAS

695


What are the data types that sas contain?

655


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

578


Explain the use of proc gplot? : sas-grid-administration

556