Database Reference
In-Depth Information
1.4.7 Choosing the “Expo rt Data” SAS Toolbar (Export Wizard) File Option
Example 1.4.7
Select “Expo r t Data” to start the SAS Export wizard. The variations between SAS versions of the Export
wizard are slight and depend upon the SAS version and operating system installed on your computer. This
example writes data to an external Excel file. The SAS Export wizard asks for the SAS dataset first, and
then asks for the external file name and location.
The SAS Export wizard defaults to pointing to your SAS datasets in your SAS WORK area, but allows you
to select an active libref assigned to your SAS session. Any SAS dataset referenced by an active
LIBNAME statement can be selected. If the SAS dataset you wish to use is not currently referenced by an
assigned libref, then you need to cancel the SAS Export wizard and return to submit a LIBNAME
statement. The wizard guides you through the process one screen at a time. Drop-down menu selections or
browse buttons on each screen allow you to search the directories and files available. This tool uses
methods similar to other Microsoft Windows search screens and should not present any navigation
problems. The SAS Export wizard will allow you to save the generated code anywhere on your computer
that you can write a file. A sample of the code generated appears below.
PROC EXPORT DATA= SASHELP.SHOES
OUTFILE= "F:\My_Excel_File\test_file_1.xls"
DBMS=EXCEL LABEL REPLACE;
SHEET="Shoes_Sheet";
NEWFILE=YES;
RUN;
1.4.8 Electing the “ I mport Data” SAS Toolbar (Import Wizard) File Option
Example 1.4.8
Select “ I mport Data” to start the SAS Import wizard. The variations between SAS versions of the Import
wizard are slight and depend upon SAS version and operating system installed on your computer. This
example reads data from an external Excel file. The SAS Import wizard asks for the external file name and
location first, and then asks for the SAS dataset name. The SAS Import wizard defaults to reading an Excel
workbook, but many other file type options are also available to read, including user-defined file formats
(see Figure 1.4.7). But, we will limit our work here to Excel file formats. The SAS Import wizard will
allow you to select both the Excel workbook and worksheet name to import. Then you can select a location
to save the generated code anywhere on your computer that you can write a file. The WORK libref is used
as the default output libref to save your data that is read from the external file, and must be assigned before
the Import wizard runs.
 
Search WWH ::




Custom Search