Creating and Editing Data |
The data in this example are quarterly sales for two employees, June and Bob.
![]() | Create a new data set by choosing File ![]() ![]() |
A dialog box prompts you for the name of the first variable. The first variable will contain the name of the sales staff. Fill in the dialog box (shown in Figure 3.1) as described in the following steps.
![]() | Type Employee in the Name field. |
The contents of this box must be a valid SAS variable name as specified in the section "Adding Variables".
![]() | In the Type field, select Character. |
![]() | Click OK. |
![]() |
Figure 3.1: Creating a Character Variable
The second variable will indicate the quarter of the financial year
for which sales are recorded. The only valid values for this numeric variable
are the discrete integers 1 - 4. Thus you will create this
next variable as a nominal variable.
![]() | Create a new variable by choosing
Edit ![]() ![]() |
Fill in the dialog box (shown in Figure 3.2) as described in the following steps.
![]() | Type Quarter in the Name field. |
![]() | Select Nominal from the Measure Level menu. |
![]() | Click OK. |
![]() |
Figure 3.2: Creating a Nominal Numeric Variable
The third variable will contain the revenue, in thousands of dollars,
for each salesperson for each financial quarter.
![]() | Create a third variable by choosing
Edit ![]() ![]() |
Fill in the dialog box (shown in Figure 3.3) as described in the following steps.
![]() | Type Sales in the Name field. |
![]() | In the Label field, type Sales (Thousands). |
![]() | In the Format list, select DOLLAR. Type 4 in the W field. |
![]() | Click OK. |
![]() |
Figure 3.3: Creating a Numeric Variable with a Format
Now you can enter observations for each variable. Note that the new data set was created with one observation containing a missing value for each variable. The first observation should be typed in the first row; subsequent observations are added as you enter them.
Entering data in the data table row marked with an asterisk ()
creates a new observation. When you are entering (or editing) data,
the ENTER key takes you down to the next observation. The
TAB key moves the active cell to the right, whereas holding down the
SHIFT key and pressing TAB moves the active cell to the left. You can
also use the keyboard arrow keys to navigate the cells of the data
table.
![]() | Enter the data shown in Table 3.1. |
Table 3.1: Sample Data
Employee | Quarter | Sales |
---|---|---|
June | 1 | 34 |
Bob | 1 | 29 |
June | 2 | 24 |
Bob | 2 | 18 |
June | 3 | 28 |
Bob | 3 | 25 |
June | 4 | 45 |
Bob | 4 | 32 |
Note: When you enter the data for the Sales variable, do
not type the dollar sign. The actual data
is , but because the variable has a
DOLLAR4. format, the data table displays a dollar sign in each cell.
The data table looks like the table in Figure 3.4.
![]() |
Figure 3.4: New Data Set
At this point you can save your data.
![]() | Select File ![]() |
Note: The default location of the personal files directory is
given in the section "The Personal Files Directory".
When you want to open your data later, you can
select File Open
File from the main
menu. The dialog box that appears has a button near the bottom that says
Go to Personal Files directory. For this reason, it is
convenient to save data in your personal files directory.
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.