DATA ABC;
INPUT TDATE DATE9. AVG;
CARDS;
18APR2008 150.00
19APR2008 167.00
20APR2008 123.00
21APR2008 145.00
;
RUN
HOW CAN I FIND THE DIFFERENCE BETWEEN AVG OF 18APR2008 ANF
21APR2008??
IF ANY ONE GETS IT PLS TRY TO POST IT.
Answer Posted / nagesh sriram
Hi,
I am think that the difference between the first and last
records value?
data _null_;
set abc end=last;
retain first;
if _n_=1 then first=avg;
if last=1 then do;
diff=first - avg;
put 'The difference is =' diff;
stop;
end;
run;
here _n_=1 is hold the first record in the abc dataset.
Last=1 means is hold the last record in the dataset.
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
How do you use the do loop if you don’t know how many times you should execute the do loop?
What are the differences between proc means and proc summary?
do you need to know if there are any missing values? : Sas programming
Explain by-group processing?
What is the order of application for output data set options, input data set options and SAS statements?
What are the different versions of sas that you have used until now? : sas-grid-administration
if a variable contain dates like "2015/01"---"2015/12" (yymm) ,How to add day to those dates,if them month is jan then 31 if the month is feb then 28 so on ...
Which function is used to count the number of intervals between two sas dates?
How you can read the variables that you need?
How would you code a merge that will write the matches of both to one data set, the non-matches from the left-most data?
what are the categories that sas informats are used to the place the data? : Sas-administrator
What is the differnce between SDTM 3.1.2 to 3.1.1 version
What is the basic structure of a sas program?
what is data access? : Sas-di
is data integration and etl programming is same? : Sas-di