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
How can you create a macro variable with in data step? : sas-macro
how does sas handle missing values in functions? : Sas programming
how do you pull data from equifax?tell me the process?
If you could design your ideal job, what would it look like?
If you use a symput in a data step, when and where can you use the macro variable? : sas-macro
How substr function works in sas?
how to remove duplicates using proc sql?
what is snowflake schema? : Sas-di
What are the data types does SAS contain?
what is metadata? : Sas-bi
Which command is used to perform sorting in sas program?
I have 3 years of work experience at a startup and recently got certified in Data Science with SAS. I need to know how to get into the analytics industry
Explain by-group processing?
what is function of retain statment
How do you use the do loop if you don’t know how many times you should execute the do loop?