14.03.2014 Views

Scripting Guide - SAS

Scripting Guide - SAS

Scripting Guide - 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.

Chapter 5 JSL Building Blocks 75<br />

Operators<br />

Comments<br />

Print(tax * Name("taxable income(2011)"));<br />

114000<br />

Name() is harmless when it is not needed. For example, tax and Name("tax") are equivalent.<br />

For more information about how JMP interprets names, see “Name Resolution” on page 97.<br />

Comments are notes in the code that are ignored by the JSL processor (or parser). You include comments to<br />

describe sections of the script. Comments are also convenient for removing portions of a script temporarily.<br />

For example, you can insert comment symbols around code that might be causing an error and then rerun<br />

the script.<br />

Type the comment symbols around code that you want to comment. The following example shows code<br />

commented with /* */ in the middle of a line. When the script is run, JMP considers both expressions to<br />

be identical.<br />

tax /*percentage*/ = .25;<br />

tax = .25;<br />

Table 5.2 describes the comment symbols.<br />

Table 5.2 Comment Symbols<br />

Symbol Syntax Explanation<br />

// // comment Begins a comment. The comment does not have to be at the<br />

beginning of a line, but everything up to the end of the line is a<br />

comment.<br />

/* */ /* comment */ Begins and ends a comment. This comment can appear in the middle<br />

of a line. Script text before and after the comment is parsed normally.<br />

//! //! Add //! to the first line of the script, and the script runs<br />

automatically when opened in JMP. (In other words, the script editor<br />

does not open.)<br />

Operators<br />

Operators are one- and two-character symbols for common arithmetic actions. Operators come in several<br />

varieties:<br />

• infix (with arguments on either side, such as + in 3 + 4, or = in a = 7)<br />

• prefix (with one argument on its right side, such as !a for logical negation)<br />

• or postfix (with one argument on its left side, such as a++ for incrementing a)<br />

JSL operators all have function equivalents.

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

Saved successfully!

Ooh no, something went wrong!