1 / 6

Don’t Import It! Setting Up a SAS Libname to an Excel Spreadsheet or Access Database… in 10 Seconds or Less!

Don’t Import It! Setting Up a SAS Libname to an Excel Spreadsheet or Access Database… in 10 Seconds or Less! . Kevin Druhan Wait Time Improvement Office Nova Scotia Department of Health druhanka@gov.ns.ca. To Import or Not to Import .

chandler
Download Presentation

Don’t Import It! Setting Up a SAS Libname to an Excel Spreadsheet or Access Database… in 10 Seconds or Less!

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Don’t Import It! Setting Up a SAS Libname to an Excel Spreadsheet or Access Database…in 10 Seconds or Less! Kevin DruhanWait Time Improvement OfficeNova Scotia Department of Healthdruhanka@gov.ns.ca

  2. To Import or Not to Import • Usually preferable to have your data in (SAS7BDAT) format • Stores SAS formats and metadata permanently • Rapid I/O (no translation required when querying data) • REALITY CHECK • The #1 Business Intelligence tool in the world is…Microsoft EXCEL. • The #1 DBMS in the world is…Microsoft Access. • You will almost certainly be analyzing EXCEL/ACCESS data at some point in your SAS career! • When your source data changes frequently, you should consider linking directly to it in SAS • Otherwiseyou will be forced to constantly re-import into SAS datasets! • Eg. Real-time reporting on a production database (dashboards etc) • You can use Excel sheets/Access tables in SAS seamlessly as if they were SAS datasets by setting up a SAS libname that points to the spreadsheet / database!

  3. Excel - How to do it • Click on Libraries in the Explorer pane. • Right-click over any white space and select New to create a new library. • Under Name, type the libname you want to give your library (8 characters max!) • Under Engine, select EXCEL. • Under Workbook, click on Browse and select your Excel file. • Under Version, select the version of Excel workbook (usually 2002) • Under Header Row, select YES if the field names are on the first line of your Excel workbook (cells A1, B1, C1, etc). • Leave Options blank. • Check Enable at Startup if you want the library to be set up every time you load up SAS (otherwise you will have to repeat all of these steps every time!)

  4. Access - How to do it • Click on Libraries in the Explorer pane. • Right-click over any white space and select New to create a new library. • Under Name, type the libname you want to give your library (8 characters max!) • Under Engine, select ACCESS. • Under Database, click on Browse and select your Access database file. • Under DB Password, type the database password (if necessary) • Leave all other fields blank. • Check Enable at Startup if you want the library to be set up every time you load up SAS (otherwise you will have to repeat all of these steps every time!)

  5. How to Use the Libnames in SAS • Excel • Use the libname you set up and the sheet name in the Excel file • Excel spreadsheets by default contain three sheets: Sheet1, Sheet2, Sheet3. • Access • Use the libname you set up and then just use the table names as if they were SAS datasets! Note the quotation marks, $, and the n.

  6. Additional Resources • For more information, read the following SAS Global Forum / Technical papers: De-Mystifying the SAS® LIBNAME Engine in Microsoft Excel: A Practical Guide http://www2.sas.com/proceedings/sugi31/024-31.pdf Importing Microsoft Access tables to SAS Datasets http://archive.chesapeakebay.net/cims/importing_data.pdf

More Related