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
How to sort in descending order?
What is SAS informats?
explain the key concept of sas? : Sas-administrator
Compare sas with other data analytics tools.
Enlist the functions performed by sas.
What is a put statement?
WHAT IS SAS WEB SERVICE and what are the steps to create an xml service ?
What is the use of function Proc summary?
Difference between informat and format?
How you are maintaining sas programmes in your company...any specific version control software you are using? If so, tell me the name?
how many types of prompts are there? : Sas-bi
Hi, Does anybody has lastest SAS certification(base, adv., clinical)dumps,if anybody has please email me at mailtorajani76@gmail.com. Thanks
What are the limitations for memory allocation for SAS variables
how to generate the test data in sas without input data? : Sas-administrator
What is the difference between order and group variable in proc report?