Practical and Efficient SAS Programming: The Insider's Guide by Martha Messineo

Practical and Efficient SAS Programming: The Insider's Guide by Martha Messineo

Author:Martha Messineo [Messineo, Martha]
Language: eng
Format: azw3, pdf
Publisher: SAS Institute
Published: 2017-09-13T04:00:00+00:00


SAS Log 5.3: Setting a Boolean

Sex=M male=1

Sex=F male=0

Sex=F male=0

Sex=F male=0

Sex=M male=1

...

The results from the INDEX() function can be used as a Boolean because the function returns a 0 if it doesn’t find the substring (0, so false), and the position of the substring if it does find it (greater than 0, so true). Program 5.6 and SAS Log 5.4 show how to use the INDEX() function as a Boolean, rather than using a comparison to create the Boolean value.

Program 5.6: Using the INDEX() Function as a Boolean

data _null_;

set sashelp.class;

if (index(upcase(name), "H")) then

putlog name=;

run;



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.