标题: how to reorder the variables sequence [打印本页] 作者: shiyiming 时间: 2013-5-2 23:29 标题: how to reorder the variables sequence data a;
input _1_x _2_y _1_t _5_r _1_abc...;
cards;
....
;
run;
there are many variables in a started with '_'+number.
question:
how can I reorder the variables by following sequence:
_1_abc _1_t _1_x _2_y _5_r ........
thx!!!作者: shiyiming 时间: 2013-5-3 13:10 标题: Re: how to reorder the variables sequence 用Retain作者: shiyiming 时间: 2013-5-6 18:03 标题: Re: how to reorder the variables sequence 建议事先将表结构定义清楚。作者: shiyiming 时间: 2013-5-7 08:32 标题: Re: how to reorder the variables sequence 参考[url:mtuw8fb2]http://support.sas.com/kb/8/395.html[/url:mtuw8fb2]作者: shiyiming 时间: 2013-5-9 12:13 标题: Re: how to reorder the variables sequence [code:3qsaw9js]
/*Select variables by order of default (alphabetic)*/
ods output Variables=vars(keep=Variable);ods listing close;proc contents data=&yourdata; run; ods listing;
/*Read into a mv*/
proc sql noprint;select Variable into :VarList separated by ' ' from vars where Variable like '_%';quit;
/*Reorder variables according to MV*/
data &yourdata;retain &VarList;set &yourdata;run;[/code:3qsaw9js]
We may think about if reordering variables is necessary or not.
JingJu作者: shiyiming 时间: 2013-6-17 10:58 标题: Re: how to reorder the variables sequence mark