2
3
4
变为
a
1
1
1
1
2
3
4作者: shiyiming 时间: 2011-9-9 15:53 标题: Re: 数据结转 [code:3o1kcmqo]data a;
input a;
cards;
1
.
.
.
2
3
3
.
3
.
4
.
.
;
data c;
set a ;
retain b;
if a>. then b=a;
run;
data d;
set a;
n=_n_;
if missing(a) then do;
do until (not missing(a));
n=n-1;
set a(keep=a) point=n; *second SET statement;
end;
end;
run;
data e;
do until(last.a);
set a;
by a notsorted;
if last.a and not missing(a) then do;
b = a;
end;
if missing(a) then do;
a=b;
end;
output;
end;
run;
[/code:3o1kcmqo]
<!-- m --><a class="postlink" href="http://communities.sas.com/message/37471">http://communities.sas.com/message/37471</a><!-- m -->作者: shiyiming 时间: 2011-9-10 09:54 标题: Re: 数据结转 [code:2tk1jckq]
data a;
input a;
cards;
1
.
.
.
2
3
3
.
3
.
4
.
.
;
data c(drop=b impute);
set a ;
retain b;
if a>. then b=a;
if missing(a) and not missing(b) then do;
impute=1;
a=b;
end;
run;
proc print;
run;
[/code:2tk1jckq]作者: shiyiming 时间: 2011-9-11 09:26 标题: Re: 数据结转 [code:1a8ylxqs]data result(drop=tmp);
set a(rename=(a=tmp));
retain a;
if not missing(tmp) then a=tmp;
run;[/code:1a8ylxqs]