14.03.2014 Views

Using JMP - SAS

Using JMP - SAS

Using JMP - SAS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

224 Formula Editor Chapter 7<br />

Examples and Tutorials<br />

Figure 7.11 Local Variables in a Formula<br />

Note: You can also create local variables using the button on the on-screen keypad. Clicking this<br />

button creates a local variable with a default name in an expression and places a semicolon after it. The<br />

default name is t1, and additional local variables are named t2, t3, and so on. You can change these default<br />

names by double-clicking and editing the name. However, you must be careful to rename each instance of<br />

the variable to avoid errors.<br />

Use the Munger Function<br />

The following examples show uses of the Munger function. In these examples, assume that there is a<br />

character column of names with “Veronica Layman” as one of its values. To simplify the examples, the literal<br />

name “Veronica Layman” is the search string instead of a column name.<br />

For instructions on how to incorporate Character functions, such as Munger, into a formula, see<br />

“Character Functions” on page 402 in the “Formula Functions Reference” appendix.<br />

Insert Characters<br />

This Munger example finds the blank between the first and last name, and inserts the middle initial “J.”<br />

The formula Munger("Veronica Layman", 1, " ", " J. ") inserts the middle initial J., and evaluates as Veronica<br />

J. Layman.<br />

Double quotes are required by the Munger function for literal strings, including strings that consist of a<br />

blank or when leading or trailing blanks are part of a string.<br />

Delete Characters<br />

To delete one or more characters from a string:<br />

1. Designate the characters to delete as the Find string in the Munger function.<br />

2. Enter an empty Replace string: two quotation marks with nothing between them.<br />

For example, the function, Munger("Veronica Layman", 1, "onic", "") removes the “onic” from Veronica<br />

and evaluates as Vera Layman.

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

Saved successfully!

Ooh no, something went wrong!