CROSSTAB TABLE TITLE CHANGE

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

CROSSTAB TABLE TITLE CHANGE

Ryan Mulligan-3
Dear List:

When analyzing using a crosstabs, does any one know how to change the title
of the table from variable label * variable label Crosstabulation. I would
like the table to say Figure 1. System Quotes.

Thank you for your feedback!

Ryan Mulligan
QA Evaluation Associate
3801 Harney Street
Omaha, NE 68131

This email is property of Region 6 Behavioral Healthcare. Any information
within this email or attached to this email is considered confidential. This
email is not to be forwarded, copied, or reproduced in any way without the
proper consent of Region 6 Behavioral Healthcare.
Reply | Threaded
Open this post in threaded view
|

Re: CROSSTAB TABLE TITLE CHANGE

Jason Burke
Hi Ray,

It sounds to me that Custom Tables is required. Allows you to build
tables to specification, including titles, footnotes and the like.

HTH,


Jason

On 1/12/07, Ryan Mulligan <[hidden email]> wrote:

> Dear List:
>
> When analyzing using a crosstabs, does any one know how to change the title
> of the table from variable label * variable label Crosstabulation. I would
> like the table to say Figure 1. System Quotes.
>
> Thank you for your feedback!
>
> Ryan Mulligan
> QA Evaluation Associate
> 3801 Harney Street
> Omaha, NE 68131
>
> This email is property of Region 6 Behavioral Healthcare. Any information
> within this email or attached to this email is considered confidential. This
> email is not to be forwarded, copied, or reproduced in any way without the
> proper consent of Region 6 Behavioral Healthcare.
>
Reply | Threaded
Open this post in threaded view
|

AW: CROSSTAB TABLE TITLE CHANGE

la volta statistics
In reply to this post by Ryan Mulligan-3
Hi Rain

I have a macro and script that allows you adding or changing existing titles
in any table. Just add the macro-call next to the table as shown in the
example.

You need the macro and the script (see below) saved on your computer for
example at:

macro (see below):
'C:\Programme\SPSS\macros\Insert_Title.sps'

and script (see below) at:
C:\Programme\SPSS\Scripts\ChangeViewer\Insert_Title.sbs

Hope this helps
Christian

*******************************
la volta statistics
Christian Schmidhauser, Dr.phil.II
Weinbergstrasse 108
Ch-8006 Zurich
Tel: +41 (043) 233 98 01
Fax: +41 (043) 233 98 02
mailto:[hidden email]



* EXAMPLE.

DATA LIST LIST/dose adverse count (3 F8.0).
BEGIN DATA
0 1 26
0 2  6
1 1 26
1 2  7
2 1 23
2 2  9
3 1 18
3 2 14
4 1  9
4 2 23
END DATA.
VALUE LABEL adverse 1'No' 2'Yes'.
WEIGHT  BY count .

INSERT  FILE = "C:\Programme\SPSS\macros\Insert_Title.sps".


CROSSTABS
  /TABLES=dose BY adverse
  /FORMAT= AVALUE TABLES
  /CELLS= COUNT ROW EXPECTED.
InsertTitle
 /label = "Figure 1"
 /before= yes
 /Keep = no.




* Place the following macro as Insert_Title.sps at
'C:\Programme\SPSS\macros.

* BEGIN MACRO.

*************************************************.
* Description                                           *.
*************************************************.

* The following macro modifies title in table.
* This is especially useful when tables are
* generated by tests (e.g. t-Test) in which
* one can't modify the title by syntax.
*
* The macro has four parameters:
**      /label
************
*       The /label parameter is the test you want to insert (or over write) in
the title.
*       The default value is ""
*       The text has to be enclosed in apostrophes
*       Any line break can be indicated with the '\n'
*       A command /label = "Table 24:\n subpopulation 1" would e..g
*       result in:      Table 24:
*                       subpopulation 1
*
**      /table
************
*       The /table parameter indicates which table is affected
*       The default value is the last table in the output viewer
*       A command /table=-2 indicates two table counted back from the last table
in the output viewer
*       A command /table= 'Ranks' would affect the last table with the title
'Rank'
*
**      /before
*       The /before parameter indicates if the new title text (from /Label) should
be place before or after the existing title.
*       The default value is No
*
**      /Keep
***********
*       The /keep parameter indicates if the existing title should be kept or not
*       The default value is NO.
*
*EXAMPLES:
*********
* The following example adds the text 'Table 24' in the table that is:
*       2 Position back from the last Table
*       A line break will be inserted between the new and the old title
*        Adds the new text BEFORE the existing text
*        and keeps the existing text.

*InsertTitle
 /label = "Table 24 \n"
 /table=-2
 /before= yes
 /Keep = yes.

* The following example adds the text 'Table 24' in the table that is:
*        last Table in the viewer
*       A line break will be inserted between the new and the old title
*        Adds the new text AFTER the existing text
*        and keeps the existing text.

*InsertTitle
 /label = "\n Table 24 "
 /before= no
 /Keep = yes.
* The following example adds the text 'Table 24' in the table that is:
*        the last Table with the title 'Ranks'
*       A line break will be inserted between the new and the old title
*        Adds the new text before the existing text
*        and doesen't keeps the existing text.

*InsertTitle
 /label = "Table 24 \n"
 /table= 'Ranks'
 /before= yes
 /Keep = no.


*************************************************.
* End Description                                               *.
*************************************************.

DEFINE InsertTitle(!POS !CHAREND('/')
                   /table  = !DEFAULT('-1')  !CHAREND('/')
                         /label  = !DEFAULT('')    !CHAREND('/')
                         /before = !DEFAULT('NO')  !CHAREND('/')
                   /keep = !DEFAULT('NO')  !CHAREND('/')
                  ) .
  !Let !L=!CONCAT('!LAB=',!UNQUOTE(!LABEL)).
  !Let !T=!CONCAT('!TAB=',!UPCASE(!UNQUOTE(!TABLE))).
  !Let !B=!CONCAT('!BEF=',!UPCASE(!UNQUOTE(!BEFORE))).
  !Let !K=!CONCAT('!KEE=',!UPCASE(!UNQUOTE(!KEEP))).

SCRIPT 'C:\Programme\SPSS\Scripts\ChangeViewer\Insert_Title.sbs'
       /(!QUOTE(!CONCAT(!T,!L,!B,!K))).
!ENDDEFINE.


* END MACRO.




''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Place the following script as Insert_Title.sbs at:
' C:\Programme\SPSS\Scripts\ChangeViewer\

'BEGIN SCRIPT:

Option Explicit

Sub Main

Dim objOutputDoc        As ISpssOutputDoc
Dim objItems            As ISpssItems
Dim objitem             As ISpssItem

Dim i,j,k       As Integer

Dim continue            As Boolean
Dim found                       As Boolean
Dim objPivotTable       As PivotTable

Dim strNewLabel         As String
Dim strMyTitle      As String

Dim strParameters       As String
Dim strTable            As String
Dim strLabel            As String
Dim strBefore           As String
Dim strKeep             As String

Dim Varitems            As Variant
Dim strInsert           As String

'Get the parameters
  strParameters = objSpssApp.ScriptParameter(0) 'GetParameters()

  strTable =Left(strParameters, _
                 InStr(strParameters,"!LAB=")-1 _
                )
  strLabel  =  Mid(strParameters, _
                 InStr(strParameters,"!LAB="), _
                 InStr(strParameters,"!BEF=")-InStr(strParameters,"!LAB=") _
                )
  strBefore  =  Mid(strParameters, _
                 InStr(strParameters,"!BEF="), _
                 InStr(strParameters,"!KEE=")-InStr(strParameters,"!BEF=") _
                )
  strKeep = Right(strParameters, _
                 Len(strParameters)-InStr(strParameters,"!KEE=")+1 _
                )


'Find the PivotTable
'either by its name (partially given) or index (counted from bottom)
  Set objOutputDoc = objSpssApp.GetDesignatedOutputDoc
  Set objItems = objOutputDoc.Items()
  If Val(Right(strTable,Len(strTable)-5))=0 Then
    i=objItems.Count
    continue=True
    found=False
    Do
      i=i-1
      Set objitem = objItems.GetItem(i)
      If InStr(UCase(objitem.Label),Right(strTable,Len(strTable)-5))>0 Then
        continue=False
        found=True
      End If
    Loop While continue And i>0
  Else
    k=0
    i=objItems.Count
    continue=True
    found=False
    Do
      i=i-1
      Set objitem = objItems.GetItem(i)
      If objitem.SPSSType=SPSSPivot Then
        k=k+1
      End If
      If k=Abs(Val(Right(strTable,Len(strTable)-5))) Then
        continue=False
        found=True
      End If
    Loop While continue And i>0
  End If

  If Not found Then
    Exit All
  Else 'We now have the PivotTable

        'Analyse the string  that should be inserted
    strNewLabel = Mid(strLabel,6)
        Varitems =Split(strNewLabel,"\n")
        strInsert = ""
    For i = LBound(Varitems) To UBound(Varitems)
       strInsert = strInsert & vbCrLf & Varitems(i)
    Next



    Set objPivotTable= objitem.ActivateTable
                strMyTitle = objPivotTable.TitleText
                If Mid(strBefore,6) = "YES" Then
                        If Mid(strKeep,6) = "YES" Then
                                objPivotTable.TitleText = LTrim(strInsert) & " " & strMyTitle
                        Else
                                objPivotTable.TitleText = LTrim(strInsert)
                        End If
                Else
                        If Mid(strKeep,6) = "YES" Then
                                objPivotTable.TitleText =  strMyTitle & " " & LTrim(strInsert)
                        Else
                                objPivotTable.TitleText = LTrim(strInsert)
                        End If
                End If
        objitem.Deactivate
  End If

End Sub

'END SCRIPT.


-----Ursprungliche Nachricht-----
Von: SPSSX(r) Discussion [mailto:[hidden email]]Im Auftrag von
Ryan Mulligan
Gesendet: Donnerstag, 11. Januar 2007 21:42
An: [hidden email]
Betreff: CROSSTAB TABLE TITLE CHANGE


Dear List:

When analyzing using a crosstabs, does any one know how to change the title
of the table from variable label * variable label Crosstabulation. I would
like the table to say Figure 1. System Quotes.

Thank you for your feedback!

Ryan Mulligan
QA Evaluation Associate
3801 Harney Street
Omaha, NE 68131

This email is property of Region 6 Behavioral Healthcare. Any information
within this email or attached to this email is considered confidential. This
email is not to be forwarded, copied, or reproduced in any way without the
proper consent of Region 6 Behavioral Healthcare.
Reply | Threaded
Open this post in threaded view
|

Errors and warnings in ASCII

Albert-Jan Roskam
Hi list,

The amount of output that SPSS creates can sometimes
be overwhelming. Because of this it could happen that
one overlooks an error or warning message. I was just
wondering if somebody has written a script which
outputs these error/warning messages to a txt file.

I am using v11 so OMS (perhaps it can also be done
with this?) is not an option. I am not even sure
whether Python files can be used, I believe only
SaxBasic scripts?

Or perhaps is there a SET option that can be used?

Thank you in advance,
Albert-Jan



____________________________________________________________________________________
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121
Reply | Threaded
Open this post in threaded view
|

Re: AW: CROSSTAB TABLE TITLE CHANGE

Peck, Jon
In reply to this post by la volta statistics
The simplest way to do this would be with an autoscript associated with Crosstabs if you often want to do this (enabling can be controlled in Edit/Options/Scripts).

Von: SPSSX(r) Discussion [mailto:[hidden email]]Im Auftrag von
Ryan Mulligan
Gesendet: Donnerstag, 11. Januar 2007 21:42
An: [hidden email]
Betreff: CROSSTAB TABLE TITLE CHANGE


Dear List:

When analyzing using a crosstabs, does any one know how to change the title
of the table from variable label * variable label Crosstabulation. I would
like the table to say Figure 1. System Quotes.

Thank you for your feedback!

Ryan Mulligan
QA Evaluation Associate
3801 Harney Street
Omaha, NE 68131