Chapter Contents

Previous

Next
The IMPORT Procedure

Example 2: Importing an Excel Spreadsheet


Procedure features:
Data source statements:
GETNAMES=
SHEET=
Other features:
PRINT procedure option:
OBS=

This example imports an Excel spreadsheet and creates a new, permanent SAS data set named SASUSER.ACCOUNTS.


Program
 Note about code
proc import datafile="c:\myfiles\Accounts.xls"
 Note about code
            out=sasuser.accounts
 Note about code
   sheet="Prices";
 Note about code
   getnames=no;
run;
 Note about code
proc print data=sasuser.accounts(obs=10);
run;


Output
The following output displays the first 10 observations of the output data set, SASUSER.ACCOUNTS.

                                   The SAS System                                  1

OBS    VAR0                                  VAR1                               VAR2

  1    Dharamsala Tea                        10 boxes x 20 bags                18.00
  2    Tibetan Barley Beer                   24 - 12 oz bottles                19.00
  3    Licorice Syrup                        12 - 550 ml bottles               10.00
  4    Chef Anton's Cajun Seasoning          48 - 6 oz jars                    22.00
  5    Chef Anton's Gumbo Mix                36 boxes                          21.35
  6    Grandma's Boysenberry Spread          12 - 8 oz jars                    25.00
  7    Uncle Bob's Organic Dried Pears       12 - 1 lb pkgs.                   30.00
  8    Northwoods Cranberry Sauce            12 - 12 oz jars                   40.00
  9    Mishi Kobe Beef                       18 - 500 g pkgss.                 97.00
 10    Fish Roe                              12 - 200 ml jars                  31.00


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.