Hi Experts,
How can we create the different version of XPT file in SAS 9.4 ??
I need the xpt V4,V5,V6,V7 and V8 file for testing .
Thanks,
Sasi.k
This covers V5 and V8, not sure about the others.
@sasikala wrote:
Hi Experts,
How can we create the different version of XPT file in SAS 9.4 ??
I need the xpt V4,V5,V6,V7 and V8 file for testing .
Thanks,
Sasi.k
@sasikala wrote:
Hi Experts,
How can we create the different version of XPT file in SAS 9.4 ??
I need the xpt V4,V5,V6,V7 and V8 file for testing .
Thanks,
Sasi.k
There is no published V4 or V6 format.
The XPORT libname engine only supports the version 5 format. Once you have a libref defined using that engine you can use it with standard SAS code. Note the V5 format means 8 character names and maximum of 200 characters for strings and other older limitations of datasets. Example code:
libname in xport 'my physical file name';
proc copy inlib=in outlib=work; run;
libname out xport 'another file name';
data out.class;
set sashelp.class;
run;
There are macros ( loc2xpt and xpt2loc) that create/read "V8" format XPORT files. Last time I looked at it does appear to have slight differences between V8 and V9 formats. At least the header records it generates include those tags.
The CPORT transport file formats used by the CPORT and CIMPORT procs are only forward compatible. You can read older files with newer versions of SAS, but you cannot create them.
Thank you so much.! Tom.
I understand, we can read only OLD version if XPT and CPORT in SAS V9 and can not create it.
Colud you please help me on below quries -
1. Is there any way to programatically identify the XPT is created by libname XPORT engine or LOC2XPT macro ?
2.Will XPT2LOC macro support to extarct the all old version XPT files and, V8 and V9 XPT file created by Libname XPORT engine ?
3. I understand V5 XPT and V8 XPT has its own format as documented in https://documentation.sas.com/?docsetId=movefile&docsetTarget=n1xbwdre0giahfn11c99yjkpi2yb.htm&docse....
My understaing here 1. The V5,V6 and V7 version XPT will support only for V5 XPT formats
2. The V8 will support only form V8 xpt format
3. The V9 will support for both V5 and V8 (VALIDMEMNAME=EXTEND option for V8)
4. Is XPT file version specific to SAS release version ? i mean V6 XPT file can be created by SAS V6 ?
Please Correct my understanding on point 3 and 4.
Thanks in advance !
There is no V6 version of XPORT format. There was not any change in the length of variable names or character strings or labels between V5 and V6 of SAS.
It was the short lived SAS V7 that introduced the longer variable names and longer character variables and longer labels. That has continued as the standard with the more popular SAS V8 (notice that the .sas7bdat extension is still being used for the files where datasets are stored).
The other changes to the structure that causes the macro to generate other headers has to do with the length of format names. Originally those were still limited to 8 characters when the names of variables and members was increased to 32. At some point that was increased also. So I think the things that the macros call V9 will support longer format names.
The macros will support read/writing the older V5 format.
If you want to check what type of file you have read the first 80. There is a clear pattern difference between the two formats.
filename xpt temp;
filename cpt temp;
libname out xport "%sysfunc(pathname(xpt))";
data out.class; set sashelp.class; run;
libname out clear;
proc cport data=sashelp.class file=cpt ;
run;
535 data _null_; 536 infile xpt recfm=f lrecl=80 obs=1; 537 input; 538 list; 539 run; NOTE: The infile XPT is: ... RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+-- 1 HEADER RECORD*******LIBRARY HEADER RECORD!!!!!!!000000000000000000000000000000 NOTE: 1 record was read from the infile XPT. 540 541 data _null_; 542 infile cpt recfm=f lrecl=80 obs=1; 543 input; 544 list; 545 run; NOTE: The infile CPT is: ... RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+-- 1 **COMPRESSED** **COMPRESSED** **COMPRESSED** **COMPRESSED** **COMPRESSED******** NOTE: 1 record was read from the infile CPT.
Thanks Tom. This helps.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.