wwang111 发表于 2013-10-24 16:17
data test;
input stockcode $ time price;
cards;
可否告知一下各个语句的意思呢,刚开始接触SAS,还不太会。为什么要加一个 by notsorted stockcode呢,我原来直接写了by stockcode,就出现了没有排序问题。if first.stockcode then call missing(lagprice)这句话又是什么意思呢。谢谢你!
如果需要事先排序,程序如下:
proc sort data=test;
by stockcode;
run;
data wanted;
set test;
by stockcode;
lagprice=lag(price);
if first.stockcode then call missing(lagprice);
run;