Chapter Contents |
Previous |
Next |
Getting Started with the SAS System Using SAS/ASSIST Software |
Importing data enables you to read data from an existing external file and create a SAS table from it. In this section, you import the file that was created in the previous section. Note that when you import a file using SAS/ASSIST software, the file must be in fixed column format.
Instructions |
Tasks | Data Management | Import Data... |
Import Data from Flat File Window
Select External File Name Window
HOUSDATA
.
Specify Output Table Window
EXTHOUSE
. Refer to SAS Tables for information about table naming.
You can store the data temporarily or permanently. For this example, store the data temporarily.
Select the libref for the location where you want to store the data, for example, the SASUSER libref. Once the import is complete, the table EXTHOUSE is stored in the SASUSER libref and remains there until you delete it.
Define Fields Window
The first line of the external file appears below the rule line. Notice that there is no space between the number of bathrooms (1) and the address (Sheppard Avenue). In fact, there are no spaces between any of the columns because you saved this file with fixed column widths rather than with delimiters between data values. Because numeric columns are right-justified, while character columns are left-justified, the data values in the bathrooms column appear to be directly adjacent to the data values in the address column. Be careful not to mark them as one data value.
Make sure you allow for the greatest width possible for each field value so that you do not inadvertently truncate some of your data.
Define Fields Window with Fields Defined
Import Window
Style
for the name of the first column. Type over the existing name (V1). See SAS Tables for information on column
naming.
?
in the Format field and press ENTER. Move the cursor to the format you want and press ENTER to select it. For this example, leave the format
blank.
?
in the Informat field and press ENTER. Move the cursor to the informat you want and press ENTER to select it. For this example, leave
the informat blank.
See SAS Language Reference: Concepts for more information on formats and informats.
Style of House
. SAS software displays the column label you assign instead of the column name. A label can contain from 1 to 40 characters.
Name | Type | Format | Informat | Label |
---|---|---|---|---|
SQFEET | NUM | Square Feet | ||
BEDROOMS | NUM | Number of Bedrooms | ||
BATHS | NUM | Number of Bathrooms | ||
ADDRESS | CHAR | Street Address | ||
PRICE | NUM | COMMA9. | COMMA9. | Price of House |
Data | Create Data Set... |
You can Edit created data set or Browse created data set from the Data menu on the menu bar.
File | Close |
File | Close |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.