Subscribe Bookmark



Jun 23, 2011

Opening an Internet Data File

JMP has long had the Internet Open command in the file menu, and similar functionality is available through JSL in JMP 7. Specifically, you can now pass a URL to the Open and Load Text File operators. Here's an example that reads crop data from the USDA site. The result is a Comma-Separated Values (CSV) text stream, which JMP opens as a data table.

Open( "", text );

Some web sites implement RESTful web services where the URL contains query fields, and the result is an XML or CSV file. Here's an example of using such a service from Yahoo Finance to get historical stock prices.

url = "";

url ||= "?s=YHOO"; // stock symbol

url ||= "&a=3"; // start month - 1

url ||= "&b=12"; // start day

url ||= "&c=2000"; // start year

url ||= "&d=11"; // end month - 1

url ||= "&e=2"; // end day

url ||= "&f=2003"; // end year

url ||= "&g=d"; // daily

Open( url, text );

Of course, you can use JSL variables instead of constants when constructing the URL to provide a parameterized query.

Article Tags