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
Hi, If anyone has base SAS certification dumps, please share.
What is the use of the %include statement?
Give some examples where proc report’s defaults are same as proc print’s defaults?
What is a macro routine?
What are the ways in which macro variables can be created in sas programming?
what is the basic structure sas administrator? : Sas-administrator
How do you delete duplicate observations in sas?
what is broad cast agent? : Sas-bi
What are types of transport files?
Hi all, If Anybody has Advance SAS Certification dumps??? Please share with me. Email: pramod.kalugade03@gmail.com
what is sas application server, database server, sas olap server and sas metadata server? : Sas-di
Describe the function and untility of the most difficult SAS macro that you have written.
explain about various caches available in data integrator? : Sas-di
For what purpose would you use the RETAIN statement?
How do you connect the desktop application to metadata server? : sas-grid-administration