Premalatha,
I hope you will find one of these helpfull. Just adding to the pool of
helkpful suggestions.
/************************************/
/** Create a Dummy data set **/
/************************************/
data a ;
input x a j z$ q $ ;
cards ;
1 2 3 qwe asd
;
run ;
/******************************************/
/** Method 1: Use when all the vars you **/
/** to reorder comprise less than 32K of **/
/** space. **/
/******************************************/
Proc sql noprint ;
select name into : VarList separated by ' , '
from dictionary.columns
where libname = %upcase("WORK")
and memname = %upcase("A")
order by name ;
create table final as
select &VarList
from a ;
quit ;
/*****************************************/
/** Or if a pure SQL Solution is too **/
/** much SQL for you try a hybrid. **/
/*****************************************/
Proc Sql noprint ;
select name into : VarList separated by ' '
from dictionary.columns
where libname = %upcase("WORK")
and memname = %upcase("A")
order by name ;
quit ;
data final ;
retain &VarList ;
set A ;
run ;
/********************************************/
/** Now if you have a really huge file that**/
/** has a large number of vars you can do **/
/** following. **/
/********************************************/
proc sql ;
create table alpha as
select name
from dictionary.columns
where libname = %upcase("WORK")
and memname = %upcase("A")
order by name ;
quit ;
filename holdvars TEMP;
data _null_ ;
file holdvars ;
set Alpha end = eof ;
IF _n_ = 1 then put 'retain ' name ;
put name ;
If eof then put ';' ;
run ;
data final ;
%include holdvars ;
set a ;
run ;
Toby Dunn