这个行吗?, 2组数据(升和降,分别存在increase和decrease)
data a;
input stkcd $ year money;
cards;
000001 2001 0
000001 2002 0
000001 2003 0
000001 2004 0
000001 2005 1
000001 2006 1
000001 2007 0
000001 2008 0
000001 2009 1
000005 2001 0
000005 2002 0
000005 2003 0
000005 2004 0
000005 2005 0
000005 2006 0
;
run;
proc expand data=a out=b method=none;
by stkcd;
convert money=money_lead /transformout=(lead 1);
convert money=money_lag /transformout=(lag 1);
run;
data increase decrease;
set b;
if money-money_lead=-1 or money-money_lag=1 then output increase;
if money-money_lead=1 or money-money_lag=-1 then output decrease;
drop time money_lead money_lag;
proc print data=decrease;run;
proc print data=increase;run;
tytyxiada 发表于 2011-2-28 11:44 
8# ntsean
请教高手:
程序的运行结果,只是输出了变化后的那个观测,而没有实现:输出的是有变化的两个观测,也就是前后年的都要输出。
请大侠再帮我看看,谢谢!