BookmarkSubscribeRSS Feed
sasikala
Obsidian | Level 7

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

1 REPLY 1
vellad
Obsidian | Level 7

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;

Ready to join fellow brilliant minds for the SAS Hackathon?

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!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 633 views
  • 0 likes
  • 2 in conversation