• No results found

Arg(expr, i) Arg Expr(expr, i)

Description

Finds the argument numbered by i within the given expression.

Returns

The ith argument within the expression expr.

Empty() if that argument does not exist or is not specified.

Arguments

expr an expression defined previously in the JSL script.

i an integer denoting which argument to return.

Notes

Arg Expr() was deprecated in a previous release of JMP. Use Arg() instead.

ARIMA Forecast(column, length, model, estimates, from, to) Description

Determines the forecasted values for the specified rows of the specified column using the specified model and estimates.

Returns

A vector of forecasted values for column within the range defined by from and to.

Arguments

column A data table column.

length Number of rows within the column to use.

model Messages for Time Series model options.

estimates A list of named values that matches the messages sent to ARIMA Forecast(). If you perform an ARIMA Forecast and save the script, the estimates are part of the script.

from, to Define the range of values. Typically, from is between 1 and to, inclusive. If from is less than or equal to 0, and if from is less than or equal to to, the results include filtered predictions.

194 JSL Functions Chapter 2

Utility Functions JSL Syntax Reference

As Column(name) As Column(dt, name) :name

dt:name

Description

This scoping operator forces name to be evaluated as a data table column in the current data table (or the table given by the optional data table reference argument, dt) rather than as a global variable.

Arguments

name Variable name.

dt The data table reference Note

:name refers to a column name in the current data table. You can also specify which data table to refer to by use dt:name.

As Date(x) Description

Formats the number or expression x so that it shows as a date when displayed in a text window.

Returns

A date that is calculated from the number or expression provided.

Argument

x Number or expression.

See Also

Section on Date-Time formats in the Scripting Guide.

As Global(name) ::name

Description

This scoping operator forces name to be evaluated as a global variable rather than as a data table column.

Arguments

name Variable name.

Chapter 2 JSL Functions 195

JSL Syntax Reference Utility Functions

As List(matrix) Description

Converts a matrix into a list. Multi-column matrices are converted to a list of row lists.

Returns A list.

Argument

matrix Any matrix.

As Name(string) Description

Evaluates argument as a string and changes it into a name.

Returns A name.

As Namespace(name) Description

Accesses the specified namespace. An error is thrown if no such namespace exists.

Returns

The namespace.

Arguments

name Unquoted name of a defined namespace.

As Scoped(namespace, variable) namespace:variable

Description

Accesses the specified variable within the specified namespace.

Returns

The value of the variable, or an error the scoped variable is not found.

Arguments

namespace The name of a defined namespace.

variable A variable defined within namespace.

196 JSL Functions Chapter 2

Utility Functions JSL Syntax Reference

As SQL Expr(x) Description

Converts an expression to code that you can use in an SQL Select statement. Use Expr(...) for literal expressions. Use NameExpr(name) for expressions stored in a variable. Otherwise, the expression returns the expression to convert.

Returns A string.

As SAS Expr(x) Description

Converts an expression to a version that is more suitable for SAS data step. Use Expr(...) for literal expressions. Use NameExpr(name) for expressions stored in a variable. Otherwise, the expression returns the expression to convert.

Returns A string.

As Table(matrix, <matrix 2, ...>, < <<invisible >, < <<Column Names(list)

>)

Description

Creates a new data tables from the matrix.

Returns

The new data table.

Argument

matrix Any matrix.

<<invisible Creates an invisible data table.

<<Column Names(list) The list specified column names for the data. The argument is a list of quoted column names.

Associative Array({key, value}, ...) Associative Array(keys, values)

Description

Creates an associative array (also known as a dictionary or hash map).

Returns

An associative array object.

Chapter 2 JSL Functions 197

JSL Syntax Reference Utility Functions

Arguments

Either list of key-value pairs; or a list, matrix, or data table column that contains keys followed by a list, matrix, or data table column, respectively, that contains the corresponding values.

Batch Interactive(Boolean) Description

Sets the run-time environment for JSL to either batch mode or interactive mode.

Returns

The previous setting.

Example

Batch Interactive(1); // Set Batch mode one

<code>

Batch Interactive(0); // Revert to previous mode Note

This function can be used in journal scripts, to ensure that messages are sent to the log rather than to interactive message windows.

Beep()

Description

Produces an alert sound.

Returns Null.

Best Partition(xindices, yindices, <<Ordered, <<Continuous Y,

<<Continuous X) Description

Experimental function to determine the optimal grouping.

Returns A list.

Arguments

xindices, yindices Same-dimension matrices.

Blob MD5(blob) Description

Converts the blob argument into a 16-byte blob.

198 JSL Functions Chapter 2

Utility Functions JSL Syntax Reference

Note

The 16-byte blob is the MD5 checksum, or the hash, of the source blob.

Blob Peek(blob, offset, length) Description

Creates a new blob from a subrange of bytes of the blob argument.

Returns

A blob object.

Arguments

blob a binary large object.

offset An integer that specifies how many bytes into the blob to begin construction. The first byte is at offset 0, the second byte at offset 1.

length An integer that specifies how many bytes to copy into the new blob, starting at the offset.

Build Information() Description

Returns the build date and time, whether it’s a release or debug build, and the product name in a comma-delimited string.

Caption({h, v}, text, <Delayed(n)>, <Spoken(Boolean)) Description

Displays a caption window at the location described by {h, v} that displays text. The caption can be delayed before being displayed by n, or can be spoken.

Returns Null.

Arguments

{h, v} a list with two values. h is the horizontal displacement from the top left corner of the monitor in pixels. v is the vertical displacement from the top left corner in pixels.

text A quoted string or a reference to a string that is to be displayed in the caption.

Delayed(n) n is optional delay before displaying the caption in seconds.

Spoken(Boolean) Causes text to be spoken as well as displayed.

Chapter 2 JSL Functions 199

JSL Syntax Reference Utility Functions

ChiSquare Log CDistribution(x, df, <nc>) Description

Returns 1 - log (value) of the distribution function at quantile x for the chi-square distribution.

ChiSquare Log Density(x, df, <nc>) Description

Returns the log of the value of the density function at quantile x for the chi-square distribution

ChiSquare Log Distribution(x, df, <nc>) Description

Returns the log of the value of the distribution function at quantile x for the chi-square distribution.

ChiSquare Noncentrality(x, df, prob) Description

Solves the noncentrality such that prob=ChiSquare Distribution (x, df, nc)

Clear Globals(<name>, <name>, ...) Description

Clears the values for all global symbols. Symbols in any scope other than global are not affected. If one or more names are specified, only those global symbols are cleared.

Returns Null.

Arguments

name Optional: any global variable name(s).

See

“Clear Symbols(<name>, <name>, ...)” on page 200

Clear Log() Description

Empties the log.

200 JSL Functions Chapter 2

Utility Functions JSL Syntax Reference

Clear Symbols(<name>, <name>, ...) Description

Clear the values for all symbols in any and all scopes. If one or more names are specified, only those symbols are cleared.

Returns Null.

Arguments

name Optional: any global variable name(s).

See

“Clear Globals(<name>, <name>, ...)” on page 199.

Copy Directory("from path", "to path", <recursive=Boolean>) Description

Copies files from one directory to another, optionally copying subdirectories. The directory name is created at the to path and should not be part of the to path.

Returns Null.

Arguments

from Specifies the directory containing the files to copy to the new directory.

to Specifies the path where the new directory should be created and to which the files are copied.

<recursive(Boolean)> Indicates whether to copy the from-directory’s subdirectory structure at the destination.

Copy File("from path", "to path") Description

Copies one file to a new file using the same or a different name.

Returns Null.

Arguments

from Specifies the path and file name to copy to the new file.

to Specifies the path and file name for the new file.