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 9 Data Tables 239<br />

Data Table Basics<br />

On Macintosh, JMP relies on the Macintosh Type and Creator codes (if present) and secondarily on<br />

three-letter filename extensions. (Type and Creator codes are invisible data that enable the Finder to display<br />

a file with the correct icon corresponding to the application that created it; files with generic icons (such as<br />

often appear on files obtained from other system) should have the filename extensions.<br />

To import a specific worksheet in a Microsoft Excel file, specify the worksheet name in the Open command.<br />

The following example imports the worksheet named small:<br />

open("C:\data\cars.xlsx", Worksheets("small"));<br />

Import multiple worksheets by including the worksheet names in brackets:<br />

open("C:\data\cars.xlsx", Worksheets( {"small", "medium", "large"} ));<br />

You can open data tables that are accessible through a Web page:<br />

open("URL", )<br />

The Web site URL is a quoted string that exactly describes the Internet location of a JMP data table. Add<br />

the extension (for example, jmp) as an unquoted named argument if the URL for the data table does not<br />

have the .jmp extension.<br />

Note that the URL is case sensitive.<br />

You can import data the same way. For example, specify text for a text import using your text import<br />

preferences.<br />

open("http://www.sas.com/", text);<br />

If you do not add the text argument, the web page is returned as a string.<br />

Additional formats include csv, script, and journal.<br />

To import a password-protected file without entering the password each time, include the Password<br />

argument:<br />

Open Database<br />

open(“housing.sas7bdat”, Password( "helloworld" );<br />

Open Database opens a database using ODBC and extracts data into a JMP data table. See the “Extending<br />

JMP” chapter on page 467.<br />

Starting a New Data Table<br />

You can start a new data table, or start a new data table and store its reference in a global. In either case, you<br />

can specify a name for the table as an argument.<br />

New Table();<br />

dt=New Table("myName.jmp");<br />

If you want to avoid a window appearing when you create a new data table, use the invisible keyword.<br />

For example, to create an invisible table Abc with one column of ten rows,<br />

dt=newTable("Abc", invisible, newColumn("X"),addRows(10));

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

Saved successfully!

Ooh no, something went wrong!