LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 2001)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 21 Mar 2001 14:41:21 -0500
Reply-To:     "Flechet, Jef" <Jef.Flechet@BASES.COM>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         "Flechet, Jef" <Jef.Flechet@BASES.COM>
Subject:      Re: Extracting data from SPSS Output tables into VB Interface.
Comments: To: Gavin Teo <spssbi2@SPSS.COM.SG>
Content-Type: text/plain; charset="iso-8859-1"

Hi Gavin,

It is possible by using the PivotTable object available in the SPSS library. Make sure to define it in VB. You can find information about the different SPSS objects in the help files. In the online help there is also a manual that introduces SPSS Script that can be quite useful in explaining the functioning of the different objects.

You will need to define the following objects: - IspssOutputDoc - IspssItems - ISpssItem - PivotTable - IspssDataCells

You will need to assign the current output window to the IspsssOutputDoc variable, loop through the IspssItems, and in the case it is a PivotTable, test whether or not this is the one with your results.

To test for the type of Object you can use the SPSSType property of the IspssItem object. In your case this would be SPSSPivot.

Once you've done that you need to assign the PivotTable.DataCellArray to the IspssDataCells object. You can then use the ValueAt(i,j) to select the element that you want to copy (either to the clipboard or to a variable). If you need to loop through the different elements of the PivotTable you can use the IspssDataCells's NumRows and NumCols Properties.

I pasted part of a code that I used to do something similar. This might make it easier for you to figure out exactly. In this case I was copying the information from a PivotTable into an array. The code will certainly not run on its own, but this should give you a clear idea of what objects, method or properties you can use to achieve what you want.

I hope this helps.

Jean-Francois Flechet

Dim objOutputDoc As ISpssOutputDoc Dim objOutputItems As ISpssItems Dim objOutputItem As ISpssItem Dim objPivotTable As PivotTable Dim objHeaderText As ISpssrtf Dim objDataCells As ISpssDataCells

Set objOutputDoc = objSpssApp.GetDesignatedOutputDoc Set objOutputItems = objOutputDoc.Items

intCount = objOutputItems.Count

For I = 1 To IntCount-1 Set objOutputItem = objOutputItems.GetItem (I) If objOutputItem.SPSSType = SPSSPivot Then Set objPivotTable = objOutputItem.ActivateTable If objPivotTable.TitleText = "CHECK TITLE FOR MLM" Then Set objDataCells = objPivotTable.DataCellArray lngNumRows = objDataCells.NumRows lngNumColumns = objDataCells.NumColumns For J = 0 To lngNumRows-1 MyArray(J)= objDataCells.ValueAt(J,lngnumColumns-1) Next End if Next

-----Original Message----- From: Gavin Teo [mailto:spssbi2@SPSS.COM.SG] Sent: Wednesday, March 21, 2001 5:10 AM To: SPSSX-L@LISTSERV.UGA.EDU Subject: Extracting data from SPSS Output tables into VB Interface.

Dear list members,

I am running logistic regression on a particular data set. One of the tables in the output (Variables in the Equation) looks like the one below.

B S.E. Wald df Sig. Exp(B) AGE 35.206 .000 AGE(1) -4.848 1.123 18.630 1 .000 .008 AGE(2) -2.373 1.174 4.088 1 .043 .093 AMEX(1) .322 .396 .658 1 .417 1.379

Is there anyway to extract out the B values(for only Age1 and Age2) from SPSS and insert in into VB interface such as TextBox or Label.

Cheers! Gavin


Back to: Top of message | Previous page | Main SPSSX-L page