Chapter Contents |
Previous |
Next |
%INPUT |
Type: | Macro statement | |||
Restriction: | Allowed in macro definitions or open code | |||
See also: |
|
Syntax | |
Details | |
Example | |
Assigning a Response to a Macro Variable |
Syntax |
%INPUT<macro-variable(s)>; |
Details |
The macro processor interprets the line submitted immediately after a %INPUT statement as the response to the %INPUT statement. That line can be part of an interactive line mode session, or it can be submitted from within the PROGRAM EDITOR window during a windowing environment session.
When a %INPUT statement executes as part of an interactive line mode session, the macro processor waits for you to enter a line containing values. In a windowing environment session, the macro processor does not wait for you to input values. Instead, it simply reads the next line that is processed in the program and attempts to assign variable values. Likewise, if you invoke a macro containing a %INPUT statement in open code as part of a longer program in a windowing environment, the macro processor reads the next line in the program that follows the macro invocation. Therefore, when you submit a %INPUT statement in open code from a windowing environment, make sure that the line that follows a %INPUT statement or a macro invocation that includes a %INPUT statement contains the values you want to assign.
When you name variables in the %INPUT statement, the macro processor matches the variables with the values in your response based on their positions; that is, the first value you enter is assigned to the first variable named in the %INPUT statement, the second value is assigned to the second variable, and so on.
Each value to be assigned to a particular variable must be a single word or a string enclosed in quotation marks. To separate values, use blanks. After all values have been matched with macro variable names, excess text becomes the value of the automatic macro variable SYSBUFFR.
Example |
In an interactive line mode session, the following statements display a prompt and assign the response to the macro variable FIRST:
%put Enter your first name:; %input first;
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.