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 / ashish

data new;

set tech ;
by year name;
if first.year or first.name then do;
sum=0;
end;
sum+value;
if last.year or last.name ;

run;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between SAS functions and procedures?

879


what are all the reports you generated in your recent project?

1931


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

1807


what is a method for assigning first.var and last.var to the by groupvariable on unsorted data? : Sas programming

762


how many display types available in sas bi dashboard? : Sas-bi

835


how does sas handle missing values in sort order? : Sas programming

712


What are the automatic variables for macro? : sas-macro

852


Explain the difference between informat and format with an example.

917


which date functions advances a date time or date/time value by a given interval? : Sas programming

729


Do you need to rearrange the order of the data for the report?

2053


Explain the special input delimiters used in sas programming.

761


what is study design in while working with SAS? what are screening variables in SAS?

1900


What do you code to create a macro? : sas-macro

798


what are the benefits of data integration? : Sas-di

741


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

820