v*******g 发帖数: 334 | 1 就是把A变成B
A 中的数据是随机的,不一定是1 2 3 。。。。。
A B
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 . |
s******r 发帖数: 1524 | 2 lag
【在 v*******g 的大作中提到】 : 就是把A变成B : A 中的数据是随机的,不一定是1 2 3 。。。。。 : A B : 1 2 : 2 3 : 3 4 : 4 5 : 5 6 : 6 7 : 7 8
|
v*******g 发帖数: 334 | 3 lag-1 ?
【在 s******r 的大作中提到】 : lag
|
s******r 发帖数: 1524 | 4 b=lag(a);
【在 v*******g 的大作中提到】 : lag-1 ?
|
T*******I 发帖数: 5138 | 5 lag是向下移一行。我也曾遇到过这个问题,问了SAS公司,他们告诉说没有这个函数。
估计新版就会有了。
【在 s******r 的大作中提到】 : lag
|
R*********i 发帖数: 7643 | 6 Sort reversly and use lag |
h********o 发帖数: 103 | 7 DATA ONE;
INPUT A @@;
CARDS;
5 4 7 8 2 1 6 8
;
DATA ONE;
SET ONE;
OBS + 1;
RUN;
PROC SORT DATA = ONE;
BY DESCENDING OBS;
RUN;
DATA ONE;
SET ONE;
B = LAG(A);
RUN;
PROC SORT DATA = ONE OUT = FINAL (DROP = OBS);
BY OBS;
RUN; |
o****o 发帖数: 8077 | 8 你们想啥呢?
直接firstobs=2,文件到头再输出以.值不久完了么? |
D******n 发帖数: 2836 | 9 data _new;
merge
_old(keep=A firstobs=2)
_old(drop=A )
;
run;
should work but it is not tested.
【在 v*******g 的大作中提到】 : 就是把A变成B : A 中的数据是随机的,不一定是1 2 3 。。。。。 : A B : 1 2 : 2 3 : 3 4 : 4 5 : 5 6 : 6 7 : 7 8
|
A*******s 发帖数: 3942 | 10 r u intentionally digging holes?
【在 T*******I 的大作中提到】 : lag是向下移一行。我也曾遇到过这个问题,问了SAS公司,他们告诉说没有这个函数。 : 估计新版就会有了。
|
|
|
T*******I 发帖数: 5138 | 11 Are you a patient? Why always follow me and tian my heel? I have said Bye by
to you and post it publicly.
【在 A*******s 的大作中提到】 : r u intentionally digging holes?
|
o****o 发帖数: 8077 | 12 data _new;
merge _old(in=_1)
_old(rename=(A=B) firstobs=2)
;
if _1;
run;
【在 D******n 的大作中提到】 : data _new; : merge : _old(keep=A firstobs=2) : _old(drop=A ) : ; : run; : should work but it is not tested.
|
d******e 发帖数: 7844 | 13 难怪大师不去英文论坛,连lick都不知道....
by
【在 T*******I 的大作中提到】 : Are you a patient? Why always follow me and tian my heel? I have said Bye by : to you and post it publicly.
|
A*******s 发帖数: 3942 | 14 when and where SAS technical told u that SAS doesn't have lag function? in
ur imagination/illusion? time for pills, man...
by
【在 T*******I 的大作中提到】 : Are you a patient? Why always follow me and tian my heel? I have said Bye by : to you and post it publicly.
|
T*******I 发帖数: 5138 | 15 I went and post several articles in English there.
I like here since I can use Chinese flawlessly, and you guys don't have any
chance to defeat me!
【在 d******e 的大作中提到】 : 难怪大师不去英文论坛,连lick都不知道.... : : by
|
d******e 发帖数: 7844 | 16 大师连wiki都保不住了,还觉得自己不败呢?
any
【在 T*******I 的大作中提到】 : I went and post several articles in English there. : I like here since I can use Chinese flawlessly, and you guys don't have any : chance to defeat me!
|
T*******I 发帖数: 5138 | 17 Did I say that of the Lag function?
【在 A*******s 的大作中提到】 : when and where SAS technical told u that SAS doesn't have lag function? in : ur imagination/illusion? time for pills, man... : : by
|
A*******s 发帖数: 3942 | 18 how dare u say u can use Chinese flawless?
【在 T*******I 的大作中提到】 : Did I say that of the Lag function?
|
T*******I 发帖数: 5138 | 19 I know who did it. Do you want to play Tom and Jerry with me? Play it with
yourself and enjoy your job. You should chase your own tail like a funny dog.
【在 d******e 的大作中提到】 : 大师连wiki都保不住了,还觉得自己不败呢? : : any
|
T*******I 发帖数: 5138 | 20 Would you like to review all the words that you put on me? I keep them all.
【在 A*******s 的大作中提到】 : how dare u say u can use Chinese flawless?
|
s******r 发帖数: 1524 | 21 data test;
do a = 1 to 10;
output;
end;
run;
data test2;set test end = eof;
c=a;
a=lag(c);
b=c;
if _n_=1 then delete;
output;
if eof then do;a=c;b=.;output;end;
drop c;
run;
【在 v*******g 的大作中提到】 : 就是把A变成B : A 中的数据是随机的,不一定是1 2 3 。。。。。 : A B : 1 2 : 2 3 : 3 4 : 4 5 : 5 6 : 6 7 : 7 8
|