14.03.2014 Views

Scripting Guide - SAS

Scripting Guide - SAS

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

Chapter 5 JSL Building Blocks 71<br />

JSL Syntax Rules<br />

JSL Syntax Rules<br />

All scripting and programming languages have their own syntax rules. JSL looks familiar if you have<br />

programmed in languages such as C and Java. However, rules for punctuation and spaces differ in JSL.<br />

The following sections describe JSL syntax rules for the following basic components of the language:<br />

• “Value Separators” on page 71<br />

• “Numbers” on page 74<br />

• “Names” on page 74<br />

• “Comments” on page 75<br />

Value Separators<br />

Commas<br />

Words in JSL are separated by parentheses, commas, semicolons, spaces, and various operators (such as +, –,<br />

and so on). This section describes the rules for using these separators and delimiters in JSL.<br />

A comma separates items, such as items in a list, rows in a matrix, or arguments to a function.<br />

my list = {1, 2, 3};<br />

your list = List(4, 5, 6);<br />

my matrix = [3 2 1, 0 -1 -2];<br />

If(Y < 20, X = Y);<br />

If(Y < 20, X = Y; Z < 3, A);<br />

TableBox(<br />

stringColBox("Age",a),<br />

NumberColBox("Count",c),...)<br />

Note: To glue a sequence of commands into a single argument inside a function, separate each sequence<br />

with a semicolon. For more information, see “Semicolons” on page 72.<br />

Parentheses<br />

Parentheses have several purposes in JSL:<br />

• Parentheses group operations in an expression. The following parentheses group the operations in the<br />

If() expression.<br />

If(<br />

Y < 20, X = Y,<br />

X = 20<br />

);<br />

• Parentheses delimit arguments to a function. In the following example, parentheses enclose the<br />

argument to the Open() function.<br />

Open("$SAMPLE_DATA/Big Class.jmp")

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

Saved successfully!

Ooh no, something went wrong!