Methods and Properties for Use with a SAS OLE Automation Object


Methods and Properties for Use with a SAS OLE Automation Object

Once instantiated , the SAS OLE automation object supports these methods as well as several properties:

  • 'Command Method' on page 268

  • 'QueryWindow Method' on page 269

  • 'Quit Method' on page 269

  • 'Submit Method' on page 270

  • 'Top Method' on page 270

  • 'Properties for Controlling a SAS Automation Object' on page 271

Command Method

Invokes a command as if it was entered from the SAS command line

Syntax

Command(' sas-command ')

Details

By default, the active window receives the command. You can change which window receives the command by changing the CommandWindow property.

Example

This Visual Basic code invokes a SAS session and opens the BUILD window:

 Set OleSAS = CreateObject("SAS.Application")  OleSAS.Command("build") 

QueryWindow Method

Queries whether a specified window exists within the SAS session

Syntax

QueryWindow(' window- name ')

Details

QueryWindow returns either True or False based on whether the specified window is open in the automated SAS session. If the window exists but is not visible, QueryWindow still returns True.

The window name that you specify must match the exact spelling of the window name in SAS. The window-name argument is not case sensitive.

Example

This Visual Basic code gets an existing SAS session and checks whether the BUILD window is open. If the window is not open, this code invokes BUILD:

 Dim OleSAS as Object  Set OleSAS = GetObject(,"SAS.Application")  If (Not OleSAS.QueryWindow("build")) Then     OleSAS.Command("build")  EndIf 

Quit Method

Ends the SAS session

Syntax

Quit

Details

If the automation controller that issues the Quit method is the only controller that is using that particular SAS session, then the SAS session ends. If at least one other automation process is still using the SAS session, then the session remains running.

Submit Method

Submits DATA step or procedure code for processing

Syntax

Submit(' SAS-program-code ')

Details

The string of text that you specify as SAS-program-code can contain multiple SAS statements separated by semicolons. The contents of the string are submitted to SAS for processing.

Example

The following example references a data library and invokes a SAS/AF application:

 Dim OleSAS as Object  Set OleSAS = CreateObject("SAS.Application")  OleSAS.Visible = True  OleSAS.Submit("libname afapp 'f:\sas\afapp';")  OleSAS.Command("af c=afapp.bigapp.main.frame") 

Top Method

Brings the SAS session to the foreground

Syntax

Top

Details

The Top method works only if the Visible property is set to True.

Example

The following example invokes a SAS session, makes it a visible window, and then brings it to the foreground.

 Dim OleSAS as Object  Set OleSAS = CreateObject("SAS.Application")  OleSAS.Visible = True  OleSAS.Top 

Properties for Controlling a SAS Automation Object

Specify various properties of the SAS automation object

Properties and Descriptions

Busy

  • indicates whether SAS is idle or working (for example, running a procedure, DATA step, and so on). This property is read only.

CommandWindow

  • sets the window (based on the window title) to receive commands you specify using the Command method. The name you specify must match the spelling of the window name exactly (though this property is not case sensitive). Once set, the window receives subsequent commands you specify with the Command method until CommandWindow is changed or set to Null (by specifying ""). If Null, which is the default, the currently active window receives the command. This property is read/write.

CommandWindowVisible

  • controls whether the window specified by the CommandWindow property is visible. If set to False, the window specified by the CommandWindow property is set to invisible. If the CommandWindow property is Null, this property has no effect. This property is read/write.

ConfirmExit

  • controls the behavior of how SAS exits. A value of 0 means that no confirmation box is displayed before SAS exits. A value of 1 means that a confirmation box is displayed before SAS exits. A value of 2 selects the default action, which is controlled by an alternative method that defines how SAS exits; for example, the Preferences dialog.

Height

  • sets the height, in pixels, of the SAS application window. This property is read/ write.

Parent

  • sets the name of the parent window that contains the SAS application window. If you change this value to another window, the SAS application window resizes to fit in the new frame. This property is read/write.

RC

  • returns the return code passed by a user function. You can set this property from within the SAS session by using the SETRC function. This property is read-only from the automation controller.

ResultString

  • returns a string passed by a user function. You can set this property from within the SAS session by using the SETRC function. This property is read-only from the automation controller.

Title

  • sets the main SAS window title. This property is read/write.

Visible

  • controls whether SAS is visible. This property is read/write.

Width

  • sets the width, in pixels, of the SAS application window. This property is read/ write.

X

  • sets the horizontal coordinate, in pixels, for the top left corner of the SAS application window. This property is read/write.

Y

  • sets the vertical coordinate, in pixels, for the top left corner of the SAS application window. This property is read/write.




SAS 9.1 Companion for Windows
SAS 9.1 Companion for Windows (2 Volumes)
ISBN: 1590472004
EAN: 2147483647
Year: 2004
Pages: 187

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net