Hi Experts,
We are updating our code to use xpt2loc macro to extract the V6 and V8 format xpt file.
Kindly help me with the below queries.
What is pros and cons of using xpt2loc macro?
Why libname xport is not supporting the V8 format xpt file which is created by loc2xpt macro?
What is the different in using xpt2loc macro and libname xport proc copy for extracting files?
Thanks,
Sasikala.k
You should find this paper helpful: https://support.sas.com/resources/papers/proceedings/proceedings/sugi23/Begtutor/p56.pdf
You can read the header line in transport files and use the correct macro, depending on the host environment where the xpt got created, something like this:
filename xptfile "&xpt";
libname sasfile "&sasds.";
data _NULL_;
infile xptfile obs=1;
input line $ASCII80. ;
call symput('engine',line);
run;
%if %index(&engine,LIBV8) > 0 %then %do;
%xpt2loc(libref=sasfile, filespec=xptfile);
%end;
%else %if %index(&engine,XPORT) > 0 %then %do;
libname xptxport xport "&dsn" access=readonly;
proc copy inlib=xptxport outlib=sasfile;
run;
%end;
%else %do;
proc cimport infile=xptfile library=sasfile memtype=data;
run;
%end;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.