This sample determines the SAS® release and the operating system in which a catalog was created. This sample program can be used in any operating system to read the catalog as an external file. It searches the text of the header record for the SAS release and operating system. The program was written to search for version information starting with SAS® 6. This is a useful program to run in the event that the following error is received:
ERROR: File MYLIB.FORMATS.CATALOG was created for a different operating system
If you receive the preceding error but want to use the catalog under your operating system, you first need to identify a compatible operating system running SAS software in which to convert the catalog to a transport file or SAS data set. The sample program on the Full Code tab creates a test format and produces an output data set. The output data set is printed showing the values for the host operating system and SAS release.
Once you have identified the native format of the catalog, you can use PROC CPORT on a compatible machine to export the catalog to transport format. On the incompatible system, PROC CIMPORT can recreate the catalog from the transport file.
Alternatively, given that it is a format catalog, the CNTLOUT= option in PROC FORMAT can be used on the compatible system to create a SAS data set. In this case, the data set rather than a transport file is used to recreate the catalog on the incompatible operating system.
Transport files and SAS data sets in directory-based operating systems are intermediary files that can be used to recreate format catalogs on incompatible operating systems. Note that a binary transfer mode rather than ASCII transfer mode is necessary when using communications software such as FTP to physically transfer either file.
For an example of converting a format catalog from 32-bit to 64-bit Windows using either method, see:
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
ERROR: File MYLIB.FORMATS.CATALOG was created for a different operating system
The SAS release and operating system are written to an output data set that is printed. To customize the program for use with your catalog, modify the %LET statement to point to the location of your catalog.
/* Create a test format to use with the sample */
libname test 'c:\';
proc format lib=test;
value testfmt
1='Yes'
2='No'
3='N/A'
;
run;
%let fmt=c:\formats.sas7bcat;
%macro cat;
%if &SYSSCP = WIN %then %let dlm=\;
%else %let dlm=/;
data catver;
retain flag 0;
length version $120;
infile "&fmt" lrecl=500 truncover;
input theline $500.;
version_loc = findc(theline,'.');
if version_loc > 0 then do;
n=anyalpha(substr(theline,version_loc));
v = substr(theline,version_loc-1);
rev=reverse("&fmt");
path=reverse(substr(rev,index(rev,"&dlm")+1));
filename=scan("&fmt",-1,'\/');
if index(v,'6.') then do;
pos=index(v,'CATALOG');
pos2=index(v,' ');
version=substr(v,1,pos2);
os=substr(v,pos+8,12);
end;
else do;
pos=anyalpha(v);
version=substr(v,1,pos+1);
os=substr(v,pos+2,10);
end;
if version ne ' ' and flag=0 then do;
output;
flag=1;
end;
end;
drop theline version_loc rev pos n v flag pos2;
run;
%mend cat;
%cat
proc print data=catver;
run;
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
The Sample output is shown written to an HTML file.
Type: | Sample |
Date Modified: | 2015-06-04 15:14:03 |
Date Created: | 2009-01-11 14:16:40 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | N/A | z/OS | ||
OpenVMS VAX | ||||
Macintosh | ||||
Macintosh on x64 | ||||
Microsoft Windows 2000 Professional | ||||
Microsoft® Windows® for 64-Bit Itanium-based Systems | ||||
Microsoft Windows Server 2003 Datacenter 64-bit Edition | ||||
Microsoft Windows Server 2003 Enterprise 64-bit Edition | ||||
Microsoft Windows XP 64-bit Edition | ||||
Microsoft® Windows® for x64 | ||||
OS/2 | ||||
Microsoft Windows 95/98 | ||||
Microsoft Windows 2000 Advanced Server | ||||
Microsoft Windows 2000 Datacenter Server | ||||
Microsoft Windows 2000 Server | ||||
Microsoft Windows NT Workstation | ||||
Microsoft Windows Server 2003 Datacenter Edition | ||||
Microsoft Windows Server 2003 Enterprise Edition | ||||
Microsoft Windows Server 2003 Standard Edition | ||||
Microsoft Windows Server 2008 | ||||
Microsoft Windows XP Professional | ||||
Windows Millennium Edition (Me) | ||||
Windows Vista | ||||
64-bit Enabled AIX | ||||
64-bit Enabled HP-UX | ||||
64-bit Enabled Solaris | ||||
ABI+ for Intel Architecture | ||||
AIX | ||||
HP-UX | ||||
HP-UX IPF | ||||
IRIX | ||||
Linux | ||||
Linux for x64 | ||||
Linux on Itanium | ||||
OpenVMS Alpha | ||||
OpenVMS on HP Integrity | ||||
Solaris | ||||
Solaris for x64 | ||||
Tru64 UNIX |