谢谢各位啦,帮我想想办法,越简单越好,再次感谢!~作者: shiyiming 时间: 2010-10-19 20:04 标题: Re: 数据变换求助 [code:1sfmq88m]data raw;
input SYZGSXXT DZZGSXXT Frequency;
datalines;
1 1 27
1 4 27
4 1 27
4 4 27
;
data out;
retain dz1-dz4 0;
do SYZGSXXT=1 to 4;
output;
end;
run;
data temp;
array dz(4);
do _n_=1 by 1 until(last.syzgsxxt);
set raw;
by syzgsxxt;
dz(dzzgsxxt)=frequency;
end;
drop dzzgsxxt frequency;
run;
data out;
modify out temp;
by syzgsxxt;
run;[/code:1sfmq88m]作者: shiyiming 时间: 2010-10-19 20:05 标题: Re: 数据变换求助 [code:szlkwn7q]data raw;
input SYZGSXXT DZZGSXXT Frequency;
datalines;
1 1 27
1 4 27
4 1 27
4 4 27
;
proc fcmp outlib=work.func.benxu;
subroutine test(inds $,obs,outds $,row_max,col_max);
array in_arr[1,1] /nosymbols;
array dz[1,1] /nosymbols;
call dynamic_array(in_arr,obs,3);
call dynamic_array(dz,row_max,col_max);
rc=read_array(inds,in_arr);
do i=1 to row_max;
do j=1 to col_max;
dz[i,j]=0;
end;
end;
do i=1 to obs;
dz[in_arr[i,1],in_arr[i,2]]=in_arr[i,3];
end;
rc=write_array(outds,dz);
endsub;
run;
options cmplib=work.func;
data _null_;
call test('work.raw',4,'out',4,4);
run;[/code:szlkwn7q]作者: Qiong 时间: 2010-10-26 17:31 标题: Re: 数据变换求助 [code:20zivjou]data c(drop=obs);
input Obs a b c;
cards;
1 1 2 27
2 1 3 12
3 4 1 23
4 4 4 45
;
run;
proc sort data=c ;
by a;
proc transpose data=c out =d(drop=_name_);
by a ;
id b;
var c ;
run;
data d;
retain a _1 _2 _3 _4;
set d;
run; [/code:20zivjou]