Importing and Exporting Data


Importing Data into a Data Set

The Import wizard guides you through the steps of importing data from many different file types into a SAS data set.

Note  

The types of files that can be imported depend on your operating system.

If your data is not in a standard file format, you can use the External File Interface (EFI) facility to import data. This tool enables you to define your file format, and offers you a range of format options. To use the EFI, select User-defined formats in the Import wizard and follow the instructions for describing your data file. This example shows you how to import a standard file and view the results.

To import a standard file:

  1. Select to open the Import wizard. Notice that Standard data source is selected by default.

    click to expand
    Display 19-21: Import Wizard Window Displaying Default Values

  2. Click the drop-down arrow to see the list of data sources. If you exported data to Excel, select Excel 97 Spreadsheet (*.xls). Otherwise, select the file format in which your data are stored.

    click to expand
    Display 19-22: Import Wizard Window Displaying List of Data Sources

  3. Click to continue.

  4. In the Select File dialog box, type the full path for your file, or click to find it.

    click to expand
    Display 19-23: Import Wizard File Selection Window

  5. Click to continue. The Select library and member dialog box appears.

    click to expand
    Display 19-24: Import Wizard Library Selection Window

  6. Type WORK for the library name and MyImport for the member name.

  7. Click to continue. If you are importing data from the Excel 97 Spreadsheet format, you are asked about saving PROC IMPORT statements. Skip this option and click . Your data are imported into the SAS data set WORK.MyImport.

Exporting Your Data with the Export Wizard

You can easily export SAS data to a variety of file formats, using the Export Wizard. The formats that are available depend on your operating environment and on the SAS software products that you have installed. The example uses the PRDSALE data set that was created in a previous example (see "Copying a Practice File to the WORK Data Library" on page 307).

To export SAS data, do the following:

  1. If it is not already open, double-click the WORK.PRDSALE data set to open it in the VIEWTABLE window.

  2. Select The Export Wizard window opens. Note that the LIBRARY and MEMBER lists contain the name of the data set (WORK.PRDSALE) that is currently displayed in the VIEWTABLE window.

    click to expand
    Display 19-25: Export Wizard Window Displaying Default Values

  3. Click to proceed to selecting an export type. Notice that Standard data source is selected by default. In the data source list, select Tab Delimited File (*.txt) , or another format that is available on your operating environment.

    click to expand
    Display 19-26: Export Wizard Window Displaying List of Data Sources

  4. Click and select a directory.

  5. Click to proceed to selecting a destination file.

  6. Type the file name MYEXPORT and click .

  7. Click .

The SAS data set is exported to MYEXPORT in the directory that you selected.




SAS 9.1.3 Language Reference. Concepts
SAS 9.1.3 Language Reference: Concepts, Third Edition, Volumes 1 and 2
ISBN: 1590478401
EAN: 2147483647
Year: 2004
Pages: 258

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net