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 14 Extending JMP 495<br />

OLE Automation<br />

JMP comes up invisible by default, as required by automation guidelines. Therefore, one of your first moves<br />

should be to make it visible, as shown in the above code.<br />

Launching an Analysis<br />

Now that you have a data table open, you can launch an analysis and manipulate it. Each analysis must first<br />

be created. Then, the required parameters for the analysis must be specified. Optional settings can also be<br />

specified. Then the analysis is launched. Additional option processing can then be done on the analysis<br />

object after the launch.<br />

Dim Oneway As JMP.Oneway<br />

Set Oneway = JMPDoc.CreateOneway<br />

Oneway.LaunchAddY ("Height")<br />

Oneway.LaunchAddX ("Age")<br />

'Set an option before the launch<br />

Oneway.Quantiles (True)<br />

'Create the initial analysis output<br />

Oneway.Launch<br />

Oneway.MeansAnovaT (True)<br />

Oneway.MeansStdDev (True)<br />

Oneway.UnequalVariances (True)<br />

Oneway.NormalQuantilePlot (True)<br />

Oneway.SetAlpha (0.05)<br />

Oneway.Save(JMP.OnewaySaveConstants.oscCentered)<br />

Oneway.Save(JMP.OnewaySaveConstants.oscStandardized)<br />

Oneway.CompareMeans(JMP.OnewayCompareConstants.occAllPairs, True)<br />

Oneway.CompareMeans(JMP.OnewayCompareConstants.occEachPair, True)<br />

The first step is to create the analysis object, which is done by calling the CreateOneway method of the<br />

document class. Next, X and Y columns are selected, and then Launch is called to create the actual<br />

One-way analysis. Each analysis platform has a distinct creation method, which you can view under the<br />

Document object in the object browser. In many cases, it is possible to specify options before the Launch of<br />

the object, so the analysis output uses the options that are already set. In this example, most option<br />

processing is done after the launch of the analysis, which shows the options popup in the display. As you can<br />

see, most methods are a simple setting of options, like you might do from a menu. SetAlpha takes a<br />

parameter, since you do not want to open a window for interaction during automation. CompareMeans<br />

takes two parameters, one for the type of comparison and one for the toggle to indicate on or off. The Save<br />

method takes a predefined constant (viewable in the object browser) that tells the Oneway analysis what to<br />

save.<br />

Most analysis methods work this way, although some like Bivariate produce additional objects when<br />

methods are called. An example is:<br />

Set Fit = Bivar.FitLine<br />

Fit.ConfidenceFit (True)<br />

Fit.ConfidenceIndividual (True)<br />

Here, the FitLine method produces an object of type Fit. This object has methods and properties of its<br />

own, which can be manipulated. Remember, the new object created by FitLine can be manipulated only<br />

while its variable is in scope.

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

Saved successfully!

Ooh no, something went wrong!