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 / aaa
PROC SORT DATA=COUNT_;
BY YEAR NAME;
RUN;
DATA TEST (DROP=VALUE);
SET COUNT_;
BY YEAR NAME;
RETAIN COUNT;
IF FIRST.NAME THEN COUNT = 0;
COUNT = COUNT + VALUE;
IF LAST.NAME THEN OUTPUT;
RUN;
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are the data types in sas?
how can you import .csv file in to sas? : Sas programming
Explain what is the use of proc gplot?
hi here is a problem can anybody solve this? i want to report the data through third party file. by using data _null_ or proc report or macro automation process. but i want to insert the 'titles and footnotes' in between the data and also starting of 2nd and ending of 2nd and starting of 3rd and ending of the 3rd page. tell me how and write the code?
Explain proc univariate?
What does proc print, and proc contents are used for?
what is the difference between calculating the 'mean' using the mean function and proc means? : Sas programming
what are the benefits of data integration? : Sas-di
what is treatment emergent events and treatment emregent adverse event
how does sas handle missing values in: assignment statements, functions, a merge, an update, sort order, formats, procs? : Sas programming
what do the sas log messages "numeric values have been converted to character" mean? : Sas programming
How are numeric and character missing values represented internally?
How do you control the number of observations and/or variables read or written?
how are numeric and character missing values represented internally? : Sas programming
How do dates work in SAS data?