Hi.
Your data structure is not look good. So I change it .
[pre]
data temp;
input oct09 nov09 dec09 jan10 feb10 mar10;
cards;
10 12 12 13 14 15 16
20 21 22 22 24 24 26
;
run;
data op(keep=_count count val var);
set temp;
count+1;
array month{*} _numeric_;
do i=1 to dim(month);
var=vname(month{i});
val=month{i};
_count+1;
output;
end;
call missing (_count);
run;
data opp;
set op;
output;
var=cats(var,'_diff');
val=lag2(val)-lag(val);
if _count in (1 2) then call missing(val);
output;
run;
proc transpose data=opp out=want(drop=_name_ count:);
by count;
id var;
var val;
run;
[/pre]
Ksharp
Message was edited by: Ksharp
Message was edited by: Ksharp
Message was edited by: Ksharp