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.

240 Data Tables Chapter 9<br />

Data Table Basics<br />

Note: To prevent “lost” data tables created invisibly, you can create an invisible data table only if you assign<br />

it a reference. If you do create an invisible data table without a reference, JMP immediately destroys it, so<br />

any further uses of the table result in errors.<br />

Tip: Once you are finished with an invisible data table, do not forget to close it. Otherwise, it remains in<br />

memory until you quit JMP.<br />

Objects and Messages<br />

Many JMP capabilities are performed by scriptable objects within JMP that know how to execute tasks<br />

relevant to themselves. Objects are entities that, once created, know how to do certain things for themselves.<br />

A JMP data table is one such object.<br />

To work with an object from JSL, you send a message to the object, asking it to perform one of its tasks.<br />

Messages are commands that can be understood only in context by a particular type of object. For example,<br />

messages for data table objects include Save, New Column, Sort, and so on. Most of these would not make<br />

any sense for a platform object, for example.<br />

Each object defines its own set of messages and what those messages mean. Although there might be some<br />

messages that happen to exist for more than one type of object, each message’s effect is determined solely by<br />

that object. This is one way in which JSL is heavily context-dependent.<br />

First, you see how to address a data table object with a reference, then how to send a message to the reference,<br />

and then learn about the messages data table objects can understand. A later section examines another type<br />

of object, data table columns. Subsequent chapters explore analysis and graph platform objects, display<br />

objects, and others.<br />

Storing a Reference to a Data Table<br />

To review, here are the various ways to get a data table open. Notice that each expression begins with an<br />

assignment to a variable. That is because each of these expressions, in addition to creating or opening the<br />

data, returns a value that is a reference to the table (a reference to a scriptable object). By assigning the data<br />

table reference to a global variable, you can use that variable to talk to the object. (This manual uses the<br />

placeholder dt to represent data table references.)<br />

dt=open("..\sample data\big class.jmp"); //Windows<br />

dt=open("::sample data:big class"); //Macintosh<br />

dt=open("$SAMPLE_DATA/Big Class.JMP"); // all operating systems<br />

dt=new table("myTable"); // create a new data table<br />

You can also assign a reference to a table you already have open, in case you did not include an assignment in<br />

your Open or New Table statement (or if you opened it through the menus):<br />

dt=data table("myTable"); // the open table named myTable<br />

dt=current data table(); // the table in the topmost window<br />

dt=data table(3);<br />

// the third open table<br />

Current Data Table can also take a scriptable object reference as an argument. For example, this would<br />

make current the data table in use by the second Bivariate object:<br />

Current Data Table(Bivariate[2]);

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

Saved successfully!

Ooh no, something went wrong!