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
Differences between where and if statement?
what is change analysis in sas di ? : Sas-di
What was the last computer book you purchased? Why?
What is your favorite all time computer book? Why?
how does sas handle missing values in sort order? : Sas programming
What are the best sas programming practices for handling very large datasets? : sas-grid-administration
what is the difference between calculating the 'mean' using the mean function and proc means? : Sas programming
Will it bother you if the guy at the next desk times the frequency and duration of your bathroom or coffee breaks on the grounds that ?you are getting paid twice as much as he is??
What is the difference between order and group variable in proc report?
What does the RUN statement do?
What are the different servers in sas? : sas-grid-administration
what is the difference between: x=a+b+c+d; and x=sum (of a, b, c ,d);? : Sas programming
Mention what is the difference between nodupkey and nodup options?
what do you mean by data staging area? : Sas-di
what is a method for assigning first.var and last.var to the by groupvariable on unsorted data? : Sas programming