SAS datasets
SAS datasets (.sas7bdat files) created with 32-bit SAS can be read directly using 64-bit SAS. However, doing this will create some inefficiency, as SAS will be doing the conversion "on-the-fly". For improved efficiency, convert the dataset to 64-bit, using PROC CPORT/CIMPORT, discussed below.
SAS Formats Catalogs
SAS Formats catalogs (.sas7bcat files) are NOT compatible between 32-bit and 64-bit SAS. If you have formats catalogs created with 32-bit SAS, you will need to re-create them using 64-bit SAS.
- If you have the original SAS code, simply run that code using 64-bit SAS.
- Lacking original SAS code, export the formats catalog using 32-bit SAS, then import using 64-bit SAS. This requires you to have access to 32-bit SAS during the migration process. Be sure to complete this before your 32-bit SAS license expires! Here is some sample code:
-
Using 32-bit SAS, export the contents (both datasets and formats catalogs) of C:\mysasdir to file transport.exp.
LIBNAME saslib 'C:\mysasdir\';PROC CPORT LIBRARY=saslib FILE='C:\mysasdir\transport.exp';RUN;
-
Using 64-bit SAS, import transport.exp to C:\mysasdir64. This creates 64-bit version of all datasets and formats catalogs originally in C:\mysasdir. Storing them in a new folder avoids any confusion.
LIBNAME saslib64 'C:\mysasdir64\';PROC CIMPORT LIBRARY=saslib64 INFILE='C:\mysasdir\transport.exp';RUN;
See Transporting SAS Libraries for more information about this process.
If you regularly need to share SAS formats catalogs with others who use 32-bit SAS, be sure to send them the formats catalog in export form, or as a SAS dataset.
SAS Code
To import Excel or Access files from 32-bit Office to 64-bit SAS, you will need to install 32-bit SAS PC Files Server (included with your SAS installation). SAS PC Files Server is a Windows service that starts automatically, and is used to translate the 32-bit Office data to 64-bit SAS.
All existing SAS code to import Excel or Access files will need to be modified:
Using PROC IMPORT, substitute DBMS=EXCELCS for DBMS=EXCEL, DBMS=ACCESSCS for DBMS=ACCESS, and remove GETNAMES and MIXED subcommands.
Example 1: Import Excel file from 32-bit Office to 64-bit SAS. Note use of EXCELCS. PROC IMPORT OUT= WORK.test
DATAFILE= "drive:\path\test.xls"
DBMS=EXCELCS REPLACE; *Use EXCELCS, not EXCEL;
SHEET="sheetname$";
RUN;
Example 2: Import Access file from 32-bit Office to 64-bit SAS. Note use of ACCESSCS. PROC IMPORT OUT= WORK.test2
TABLE= "tablename"
DBMS=ACCESSCS REPLACE; *use ACCESSCS, not ACCESS;
DATABASE="drive:\path\test2.accdb";
RUN;
Using LIBNAME, add PCFILES engine.
Example 3: Import Excel file from 32-bit Office to 64-bit SAS.
libname in pcfiles path="drive:\path\test.xls" ;
data test;
set in."sheetname$"n;
run;
libname in clear;
Example 4: Import Excel file from 32-bit Office to 64-bit SAS.
libname in pcfiles path="drive:\path\test2.accdb";data test2;
set in.tablename; * (Access table name must be valid SAS name);
run;
libname in clear;
For more information, see SAS/Access 9.3 Interface to PC Files Reference and SAS Usage Note 33228.