由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - SAS dataset 中,怎么把数据往上移一行?
相关主题
sas大牛们这个要怎么实现呀询问一个SAS数据处理问题
[提问]怎样sort这个dataset?请教SAS中如何如果flag的问题
which route in SAS is faster?SAS memory management
求教一个简单的data step 牛肉包求救:SAS programmer面试题!
[SAS] data set options (obs=) in output tablesHow to Macro it in SAS?
SAS adv question.请大家帮忙看看A question in splitting dataset
用SAS sampling的一个问题问个效率问题 SQL vs data step,大数据量
one quick question about concatenating data in SASbase 70 - Q27
相关话题的讨论汇总
话题: data话题: run话题: lag话题: sas话题: 定是
进入Statistics版参与讨论
1 (共1页)
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公司,他们告诉说没有这个函数。
: 估计新版就会有了。

相关主题
SAS adv question.请大家帮忙看看询问一个SAS数据处理问题
用SAS sampling的一个问题请教SAS中如何如果flag的问题
one quick question about concatenating data in SASSAS memory management
进入Statistics版参与讨论
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

1 (共1页)
进入Statistics版参与讨论
相关主题
base 70 - Q27[SAS] data set options (obs=) in output tables
SAS菜鸟请教如果使SAS的output的结果放到一个文件内?SAS adv question.请大家帮忙看看
SAS help : Proc dataset用SAS sampling的一个问题
请教sas base(70)的27题one quick question about concatenating data in SAS
sas大牛们这个要怎么实现呀询问一个SAS数据处理问题
[提问]怎样sort这个dataset?请教SAS中如何如果flag的问题
which route in SAS is faster?SAS memory management
求教一个简单的data step 牛肉包求救:SAS programmer面试题!
相关话题的讨论汇总
话题: data话题: run话题: lag话题: sas话题: 定是