14.03.2014 Views

Using JMP - SAS

Using JMP - SAS

Using JMP - SAS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Appendix B Formula Functions Reference 407<br />

Character Functions<br />

Regex<br />

The first argument is the source string that Regex searches for a match to the pattern. The second argument<br />

is the pattern, in the form of a regular expression. The Formula Editor prompts you for these two required<br />

arguments.<br />

Tip: For more information about using regular expressions, search the Internet for regular expression tutorial.<br />

By default, Regex performs a case-sensitive search and returns the parts of the source string that match the<br />

pattern that you specified (or returns MISSING if the match fails). There are two optional arguments that<br />

you can add. You can type a third argument—the format—that specifies the string to return. If you choose,<br />

you can use regular expressions to specify replacement text in the returned string. If you specify the third<br />

argument, you can also specify IGNORECASE so that Regex ignores capitalization when searching the<br />

source string for a match.<br />

Table B.1 Regex Examples<br />

Sample Regex function<br />

Regex( "@ q3 #", "([a-z])([0-9])" )<br />

Regex( "@ Q3 #", "([a-z])([0-9])",<br />

"\0",IGNORECASE)<br />

Regex( "@ Q3 #", "([a-z])([0-9])",<br />

"\2\1",IGNORECASE)<br />

String that is returned<br />

q3<br />

The function is case sensitive, so q3 matches but Q3<br />

would not.<br />

Q3<br />

Although \0 is the default argument, it is required in<br />

this example so that IGNORECASE can be<br />

specified.<br />

3Q<br />

For more information and an example that you can run, select Help > Indexes > JSL Operators and<br />

select Regex.<br />

Hex to Blob, Char to Blob, Blob to Char<br />

Hex to Blob converts the hexadecimal to a blob (Binary Large Object).<br />

Char to Blob converts the string to a blob. You can specify the encoding in an optional second argument.<br />

Supported encodings are: utf-8, utf-16le, utf-16be, us-ascii, iso-8859-1, and ascii~hex.<br />

Blob to Char converts the blob to a string. You can specify the encoding in an optional second argument.<br />

Supported encodings are: utf-8, utf-16le, utf-16be, us-ascii, iso-8859-1, and ascii~hex.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!