Help using Base SAS procedures

Convert SAS Catalog files into transport (.xpt) files in windows and import in linux environment by converting them back to catalog files

Reply
New Contributor
Posts: 3

Convert SAS Catalog files into transport (.xpt) files in windows and import in linux environment by converting them back to catalog files

I recently started working on SAS and  currently i am on a data migration project wherein I am required to find the catalog files (sas7bcat) in various folders and convert them into .xpt files. I have approximately 500 catalog files in the network drive which I need to convert into .xpt files. Once I do that I need to convert them back to .sas7bcat format in linux server.

I am learning proc cport and cimport but I am unable to understand how exactly is the code utilized and how do I use to convert a large number of files at a time.

Can anyone please guide me as to what approach I need to take and any sample codes that I can follow to achieve the goal.

Thank you.

Super User
Posts: 10,538

Re: Convert SAS Catalog files into transport (.xpt) files in windows and import in linux environment by converting them back to catalog files

Are your catalogs in a single library or multiple libraries? For each library:

filename tranfile 'transport-file'; /* obviously use a different file name for each library*/

proc cport library=sourcelibrary file=tranfile memtype=catalog;

run;

New Contributor
Posts: 3

Re: Convert SAS Catalog files into transport (.xpt) files in windows and import in linux environment by converting them back to catalog files

Thanks a lot Ballard. That really helped. I could create transport files.

I encountered an unexpected error though. I got the following error while generating .xpt files form catalog files in a particular network drive:

ERROR: File SOURCE.FORMATS.CATALOG was created for a different operating system.

I researched on it and found out that this occurs because the format was generated in probably a 32 bit operating system. I am currently using 64 bit operating system.

I am not able to get around this issue. I tried using the option- options nofmterr; before running the code for generating the .xpt file but SAS still doesn't read the catalog.

Is there a way I can work on it or is it necessary to return to the source operating system and generate the transport file?

Please advise.

Super User
Posts: 6,964

Re: Convert SAS Catalog files into transport (.xpt) files in windows and import in linux environment by converting them back to catalog files

The error message indicates that the format(s) would not have worked in your current environment at all (any use would have caused the ERROR message you got); I think it is safe to consider the catalog as legacy that can be discarded.

If you find you absolutely need the contents and can't recreate the original environment (for which you need the OS, SAS version & valid license), inspecting the catalog with a hex tool might be helpful as a last resort.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
New Contributor
Posts: 3

Re: Convert SAS Catalog files into transport (.xpt) files in windows and import in linux environment by converting them back to catalog files

I have multiple catalog files scattered in various folders in a network drive. Currently I am using a code that generates a single transport file at a time. I was wondering if there is a way to point out the paths to SAS so that it can generate all the transport files at one time in the same folder where the catalog file is located or do I need to manually create the transport files for each catalog.

Super User
Posts: 10,538

Re: Convert SAS Catalog files into transport (.xpt) files in windows and import in linux environment by converting them back to catalog files

You should be able to create a library that points to multiple locations. Then when using that library for the cport code you'd get them all.

Something like:

libname port ("c:\project1\datafolder"  "e:\project2\datafolder");

and then use the PORT library.

I don't know if there is any way to segregate them out with cimport on the other end though.

Valued Guide
Posts: 3,208

Re: Convert SAS Catalog files into transport (.xpt) files in windows and import in linux environment by converting them back to catalog files

cport cimport are tools for upgrading all data to a similar bitness system. To have full functionality SAS/Share or SAS/connect is needed.

38339 - SAS® file compatibility when upgrading from 32-bit to 64-bit Microsoft Windows  This seems to get working (one direction) at Windows

For Unix it is different as it notes the requirement of SAS/Connect or SAS/SHare

SAS(R) 9.4 Companion for UNIX Environments, Fourth Edition

---->-- ja karman --<-----
Super User
Posts: 3,115

Re: Convert SAS Catalog files into transport (.xpt) files in windows and import in linux environment by converting them back to catalog files

If the FORMAT catalog you are trying to export from Windows 64-bit SAS is 32-bit then it would not be usable under Windows 64-bit SAS so there would be no point exporting it anyway.

Do you have access to say Windows 32-bit SAS on a desktop somewhere to be able to test the catalog out?

Ask a Question
Discussion stats
  • 7 replies
  • 807 views
  • 7 likes
  • 5 in conversation