stat 440 lab exercises 1
stat 440 lab exercises 1
Enhanced Editor
The Enhanced Editor (the default editor on Windows) provides many helpful features, including
color coding and automatically retaining the program after each submit, eliminating the need to
recall your program.
In the Enhanced Editor, each program you open will open a new Enhanced Editor. You can have
numerous Enhanced Editors open at one time. However, if you are using the Program Editor, you
can only have one Program Editor open at a time.
The Enhanced Editor is available only on Windows.
The program contains three steps: a DATA step and two PROC steps.
As you browse the program, notice the following:
• The syntax is color-coded to show
– step boundaries
– keywords
– variable and data set names.
• A section boundary line separates each step.
1
Statistics 440: Lab Exercises 1
With the Enhanced Editor, you have the ability to minimize and maximize each DATA or
PROC step. A minus sign next to DATA or PROC indicates that the code has been
expanded. To minimize the DATA or PROC step, click on the minus sign. Once the step
has been minimized, the minus sign turns into a plus sign . To maximize the step after
it has been minimized, click on the plus sign.
You can customize the appearance and functionality of the Enhanced Editor by selecting
Tools Options Enhanced Editor.
3. Issue the SUBMIT command or click on or select Run Submit to submit the
program for execution. The output from the program is displayed in the Output window.
You can submit the code when it is collapsed. This is helpful if you want to highlight a
portion of the program and submit only that portion. You can highlight the entire line that
is visible for a step and submit it. To highlight the entire line, click to the left of the plus
sign .
______________________________________________________________________________
Portions Copyright 2007 by SAS Institute Inc., Cary, NC, USA. All rights reserved.
Reproduced with permission of SAS Institute Inc., Cary, NC, USA. SAS Institute Inc. makes no
warranties with respect to these materials and disclaims all liabilities thereof.
2
Statistics 440: Lab Exercises 1
To scroll vertically within the Output window, use the vertical scrollbar or issue the FORWARD
and BACKWARD commands or use the PAGE UP or PAGE DOWN keys on the keyboard.
You also can use the TOP and BOTTOM commands to scroll vertically within the Output
window.
1. Scroll to the top to view the output from the PRINT procedure.
2. Issue the LOG command or select Window Log or click on the log to display the Log
window and browse the messages that the program generated.
3
Statistics 440: Lab Exercises 1
Partial Log
The Log window contains the programming statements that are submitted, as well as notes
about
• any files that were read
• the records that were read
• the program execution and results.
In this example, the Log window contains no warning or error messages. If the program
contains errors, relevant warning and error messages are also written to the SAS log.
4. Issue the END command or select Window Program Editor to return to the Program
Editor window.
4
Statistics 440: Lab Exercises 1
2 infile 'raw-data-file';
3 input LastName $ 1-20 FirstName $ 21-30
4 JobTitle $ 36-43 Salary 54-59;
5 run;
6
7 proc print data=work.staff
8 run;
---
22
-
200
ERROR 22-322: Syntax error, expecting one of the following: ;,
(, DATA, DOUBLE, HEADING, LABEL, N, NOOBS, OBS,
ROUND, ROWS, SPLIT, STYLE, UNIFORM, WIDTH.
ERROR 200-322: The symbol is not recognized and will be ignored.
9
5
Statistics 440: Lab Exercises 1
6
Statistics 440: Lab Exercises 1
There are no notes in the SAS log because all of the SAS statements after the INFILE statement
have become part of the quoted string.
The banner on the window indicates the DATA step is still running because the RUN
statement was not recognized.
1. To correct the problem in the Windows environment, click the break icon or press the
Ctrl and Break keys.
2. Select 1. Cancel Submitted Statements in the Tasking Manager window and select OK.
7
Statistics 440: Lab Exercises 1