Previous Page | Next Page

Entering Data Interactively

Entering Data


Instructions

To enter data interactively, selectTasks [arrow] Data Management [arrow] Create data [arrow] InteractivelyThe Enter Data Interactively window appears.

Enter Data Interactively Window

[Enter Data Interactively Window]


Entering Data in a Tabular Format

  1. Select Enter data in tabular form. The Select a New SAS Table to Create window appears.

    Select a New Table to Create Window

    [Select a New Table to Create Window]

  2. In the Table field, type SALES as the name of the table that you want to create for the new data. Refer to SAS Tables for information about table naming conventions.

  3. You can store the table temporarily or permanently. For this example, store the table temporarily.

    • If you want to store the data only for the duration of the SAS session, then select Temporary. The data is stored in a temporary table called WORK.SALES, which is deleted when you end the SAS session.

    • If you want to store the data permanently, then select Permanent. A list of existing librefs appears. Select the libref for the location where you want to store the data, for example, the SASUSER libref. The table SALES is stored in the SASUSER library and remains there until you delete it.

  4. Select OK. The Define a New SAS table window appears.

    Note:   Replace if existing enables you to replace the existing table with a new table of the same name. If the SALES table already exists, then you get an error message stating this. You may either enter another name for the table or select Replace if existing to replace the existing table.  [cautionend]

    Define a New SAS Table Window

    [Define a New SAS Table Window]

  5. In the Name field, type MONTH as the name of the first new column.

  6. In the Type field, type a $ or a C to indicate that the column is a character column.

    A column can be character or numeric. If a column is defined as character, then it can contain letters, numbers, special characters, and symbols, but it cannot be used in arithmetic calculations. A character column is indicated by a $ or a C in the Type field.

    If a column is defined as numeric, then it can contain only numbers, decimal points, plus signs, and minus signs, and it can be used in arithmetic calculations. A numeric column is indicated by a blank or an N in the Type field.

  7. For the length, type 3 . Each character uses one byte. The length indicates the number of bytes used to store each of a column's values in a SAS table. A character column can have a length from 1 to 32767.

  8. For the label, type Sales Month . The label is a description of up to 40 characters that can be printed by certain tasks instead of, or in addition to, the column name.

  9. In the second row of the Name field, type GSALES as the name of the second new column.

  10. Leave the Type field blank to indicate that the column is numeric.

  11. For the length, type 8 . A numeric column can have a length of 2 to 8 bytes or 3 to 8 bytes, depending on your operating environment. If you leave this field blank, then it will use a length of 8 by default.

  12. For the label, type Gross Sales .

  13. In the Format field, type dollar8.2 and press ENTER. A format is a pattern that SAS uses to determine how a column value should be displayed. SAS provides a set of standard formats and also enables you to define your own custom formats. The dollar8.2 format inserts a dollar sign before each entry, inserts commas for numbers greater than 999, and writes a decimal point and two decimal digits.

  14. SelectFile [arrow] CloseA prompt appears to ask you if you want to save changes to the WORK.SALES table. Select Yes. The FSVIEW window opens to let you type new data for the columns you just defined.

    Typing Data into WORK.SALES

    [Typing Data into WORK.SALES]

    Each row in the window represents information for each sale. Each column represents a particular type of data for the sales. When you type data in a tabular format, multiple rows are shown in one window.

  15. Type data in each field, and press TAB to move from field to field if necessary. For example, type JAN for the month and 3051.20 for the first GSALES entry.

    When you have typed one row of data, press ENTER and another NEW row appears. The format you just specified also adds the dollar sign and comma to the amount of sales when the data appears. Type the rest of the data as shown here:

       FEB   2813.50
       MAR   3214.80
       APR   3471.00
       MAY   3943.70

    Use the scroll bars or the BACKWARD, FORWARD, LEFT, and RIGHT function keys to see all the columns and rows.

    Note:    If you make an error while typing the data, then position the cursor on the row you want to edit and press ENTER. The row of data is highlighted to indicate that it is selected. To edit the data, press TAB to move the cursor to the data you want to change, and type the new data over the old data. To edit another row, repeat these steps.  [cautionend]

    Refer to Editing and Browsing Data for more information about editing data.

  16. When you have finished entering rows, selectFile [arrow] Closeto exit the FSVIEW window.

    Refer to Editing and Browsing Data for instructions on editing and browsing the data you just entered.


Entering Data One Row at a Time

SelectTasks [arrow] Data Management [arrow] Create data [arrow] Interactively

Follow steps 1 through 14 in Entering Data in a Tabular Format except, in step 1, select Enter data one record at a time from the Enter Data Interactively window. In step 2, name the table SALES2 .

After you have defined your columns, select Close from the File menu, and then select Yes to save the changes to the table. The FSEDIT window appears for the first row with the word New at the top of the window.

Entering Data into WORK.SALES2

[Entering Data into WORK.SALES2]

  1. Type the following data in each field, and press TAB to move from field to field if necessary:

       JAN   4339.20

    When you have typed in one row of data, press ENTER, and the dollar sign and comma are added to the amount of sales.

  2. To add the next new row, follow this selection path:Edit [arrow] Add New RecordA blank row appears with the word New in the upper right corner of the window. Continue to add new rows to add the following data:

       FEB   3482.50
       MAR   4238.80
       APR   3529.00
       MAY   3433.70

    To view other rows you have already added, select View from the menu bar and use the items as described here:

    • Select Next Observation to move forward to the next row.

    • Select Previous Observation to move backward to the previous row.

    • Select Observation Number to move to a specific row. The Observation Number window appears. Type the number of the row you want to display and select OK. The row you requested appears.

    • If there are more columns that will fit on one screen, then each row has as many screens as necessary to display all of the columns for the row. Use Next Screen and Previous Screen from the View menu to move from screen to screen within a row.

  3. When you have finished entering data, selectFile [arrow] Closeto exit the FSEDIT window.

    Refer to Editing and Browsing Data for instructions on viewing and editing the data you just entered.

Previous Page | Next Page | Top of Page