data a1;
set aa;
by id;
if first.id then time =1;
else time +1;
run;
data bb (drop = time);
merge a1(where= (time=1)) a1(where= (time=2) rename =(x1 = x1a x2 = x2a));
by ID;
run;[/code:648a1]作者: shiyiming 时间: 2007-6-13 01:29 标题: Re: 数据整理求助 非常感谢JOY的无私帮助,可是我的数据集是一个有162万条以上记录的大数据集,同一ID号的数据有1536行,能帮我再想想办法吗?不胜感谢。作者: shiyiming 时间: 2007-7-11 12:03 标题: Re: 数据整理求助 Joy's solution is the simplest based on the sample data you provided. The solution you wanted are highly dependent on the data sturcture. Base on your descripton, you have 1.62 million rows and 1536 unique ID. Therefore, you have about 1055 observations for each ID. Was your purpose to create a data with
1536 rows and 1055 columns or 2110 columns?
Please give more details before anybody can really help you.作者: shiyiming 时间: 2007-7-11 20:12 标题: Re: 数据整理求助 hehe, common problem in asking question: when you simplify your question, sometimes it's too simple <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->作者: shiyiming 时间: 2007-7-12 13:47 标题: Re: 数据整理求助 I am very happy to see you are happy with having stupid structure dataset.
data final(keep=y1-y3072);
array y y1-y3072;
retain y1-y3072 ;
set ahuige;
by id;
n+1;
y(n*2-1)=x1;
y(n*2)=x2;
if last.id then
do;
output;
n=0;
do i=1 to 3072;
y(i)=.;
end;
end;
run;[/code:73dbe]