Can some one help me in using %input macro statement in SAS. I came to know by googling, that %input is a macro statement used to create macro variables.
Asked
Active
Viewed 505 times
-2
-
Umm. I don't get the question. Usually you create macro variable by `%let var_name= 'Value';` You can do this dynamically too `%let var_name= &another_var;` – pinegulf Jan 18 '18 at 07:46
-
Yes what you said is right. But their is another way for creating macro variable using %input statement. And want to know, how to use it? – Saran Jan 18 '18 at 08:39
1 Answers
1
%INPUT
should only be used in legacy situations.
The documentation, if you read it, states the conditions for use.
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.
This means you are typing in values from a console or submitting code in the Program Editor. %INPUT will cause an error when submitted from the default Enhanced Editor or to a SAS server.
Program Editor
%symdel a b c;
%input a b c;
123 456 pqr
%put NOTE: &=a &=b &=c;
--- LOG ---;
30 %input a b c;
31
32 %put NOTE: &=a &=b &=c;
NOTE: A=123 B=456 C=pqr
Enhanced Editor
%symdel a b c;
%input a b c;
123 456 pqr
%put NOTE: &=a &=b &=c;
--- LOG ---;
34 %input a b c;
35 123 456 pqr
---
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
36
37 %put NOTE: &=a &=b &=c;
NOTE: A= B= C=

Richard
- 25,390
- 3
- 25
- 38