In reply to Shoaib shaikh.

Hi Shoaib, regardless of what you are allowed to use, here is a code example showing how you can compare column names and their orders in two data tables SASLIB1.DATA1 and SASLIB2.DATA2:

proc sql noprint;
select name into : vlist1 separated by ' '
from SASHELP.VCOLUMN
where libname='SASLIB1' and memname='DATA1';

select name into : vlist2 separated by ' '
from SASHELP.VCOLUMN
where libname='SASLIB2' and memname='DATA2';
quit;

%put &=vlist1;
%put &=vlist2;

%if &vlist1=&vlist2 %then
%do;
%put COLUMN ORDER MATCHED;
%end;
%else
%do;
%put COLUMN ORDER DOES NOT MATCH;
%end;

You can adapt this to your program accordingly. Hope, this helps.