Posts

Showing posts with the label MINOPERATOR

Macro IN Operator

Have you ever come across a situation where you have to write a macro program where a macro variable has more than one value? Writing a macro program in this case involves so many different conditions and to connect each condition you generally use OR operator as below… %macro test ; %if &dsn= ae or %if &dsn= ds or %if &dsn= co or %if &dsn= cm %then %do ; Some---SAS—Statements; %end ; %test ; You can use a simple IN operator inside the datastep and make the code very simple… like as follows… data dsn; set old; if &dsn in (" ae" ," ds" ," co" ," cm" ) then do ; Some---SAS—Statements; end ; run ; Can we use the same IN operator inside the macro… If you are using any SAS version prior to 9.2 … the answer is.. You cannot use IN operator inside the macro. But….. In SAS 9.1.3 version: You can use character # (new binary comparison operator) as an alternate operator to mnemonic IN operator. ...