Search code examples
sasexport-to-excel

How to export xlsx files in SAS


The following two exports, will give an error on my machine (in both SAS base and SAS Enterprise Guide):

proc  export data=  sashelp.shoes
            outfile= " D:\SAS\myfile.xlsx"
            dbms=xlsx replace;
       sheet="Shoes";
run;

proc  export data=  sashelp.class
            outfile= " D:\SAS\myfile.xlsx"
            dbms=excelcs replace;
       sheet="Class";
run;

as these exports produce the following errors respectively:

ERROR: DBMS type XLSX not valid for export.
ERROR: DBMS type EXCELCS not valid for export.

By browsing the internet I think that the problem is caused by exporting the file from a 64-bit SAS version to a 32-bit Excel version.

I downloaded and installed pcfilesrv__931401__win__en__web__1.zip from the SAS Support website and hoped it would solve the problem, however the errors still occur.

Anybody with another idea?

Specs:

Windows 64-bit Operating System

SAS Enterprice Guide 5.1 (64-bit)

SAS Base 9.3 (64-bit)

Excel 2013 (32-bit)

EDIT: @Grinvydas Kareiva mentioned in his answer that I needed the "SAS/Access Interface to PC Files". This installation wizard after running setup.exe in the zip file I downloaded from the SAS Support website (see above). Install Wizard

However, when I run proc setinit, it doesn't show up anywhere (changed site number and name manually):

Site name:    'xxxxxxx'.
Site number:  xxxxxx.
Expiration:   01SEP2017.
Grace Period:  62 days (ending 02NOV2017).
Warning Period: 31 days (ending 03DEC2017).
System birthday:   01NOV2016.
Operating System:   WX64_WKS.
Product expiration dates:
---Base SAS Software                                                                                    01SEP2017  
---SAS/STAT                                                                                             01SEP2017  
---SAS/GRAPH                                                                                            01SEP2017  
---SAS Enterprise Guide                                                                                 01SEP2017  
---SAS Workspace Server for Local Access                                                                01SEP2017

Am I doing something wrong?


Solution

  • Firstly, you need to have licensed "SAS/ACCESS Interface to PC Files". You can check that in the log after submitting

    proc setinit;
    run;
    

    One of these should work if you have that interface

    dbms=excel or dbms=xlsx