BookmarkSubscribeRSS Feed
sj_30
Calcite | Level 5

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.

7 REPLIES 7
ballardw
Super User

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;

sj_30
Calcite | Level 5

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.

Kurt_Bremser
Super User

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.

sj_30
Calcite | Level 5

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.

ballardw
Super User

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.

jakarman
Barite | Level 11

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 --<-----
SASKiwi
PROC Star

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?

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 7 replies
  • 2558 views
  • 7 likes
  • 5 in conversation