OMS in der Syntax

Alles rund um SPSS Syntax und Programmierung.

OMS in der Syntax

Beitragvon doc_rolfo » Fr 24. Mär 2023, 13:09

Hallo,

da ich die Syntax-Kommentare in meiner OMS-Ausgabe benötige habe ich mich entschieden, das OMS über den folgenden Weg zu nutzen:

Code: Alles auswählen
OMS
  /SELECT ALL EXCEPT = [HEADINGS WARNINGS]
  /DESTINATION VIEWER=YES
  FORMAT = XLSX
  OUTFILE = 'test_OMS.xlsx'.


Allerdings kann ich nur spezifische output objects (also Headings, Warnings etc.) ausschließen. Kennt jemand einen Weg, hier auch commands ('Frequencies') oder subtypes ('One Sample Test') mit auszuschließen? Wenn ich diese mit

Code: Alles auswählen
/IF COMMANDS=['Frequencies' 'CTables' 'T-Test'] SUBTYPES=['Frequencies' 'Custom Table' 'One Sample Test']


mit in die obige Abfrage einbaue, dann werden sie eingeschlossen, nicht ausgeschlossen. Die Syntax Referenz gibt dazu leider sehr wenig her.
Bin für jede Hilfe dankbar, da auch eine intensive Web- und Youtube-Suche nix gebracht hat.
Gruß,
doc_rolfo
doc_rolfo
 
Beiträge: 5
Registriert: Fr 24. Mär 2023, 12:55
Danke gegeben: 0
Danke bekommen: 0 mal in 0 Post

Re: OMS in der Syntax

Beitragvon strukturmarionette » Fr 24. Mär 2023, 20:46

Hi,

Die Syntax Referenz gibt dazu leider sehr wenig her.

- was schreibt denn die SPSS-Syntax dazu?

Gruß
S.
strukturmarionette
 
Beiträge: 2454
Registriert: Sa 1. Okt 2011, 17:20
Danke gegeben: 7
Danke bekommen: 122 mal in 122 Posts

Re: OMS in der Syntax

Beitragvon doc_rolfo » Mo 8. Mai 2023, 11:46

Hallo strukturmarionette,

ich bin mir unsicher, ob ich jetzt die Seiten 1373-1398 der Syntax Referenz einpasten soll. Der wichtige Teil für mich ist auf S. 1375, wo die ganzen objects aufgelistet werden. ABER was nicht da steht, ist dass man nur jeweils eine Art durch Subtypes einschränken kann (S.1378).

Wie kann ich mehrere Objects durch subtypes einschränken?

Gruß,
Doc Rolfo
doc_rolfo
 
Beiträge: 5
Registriert: Fr 24. Mär 2023, 12:55
Danke gegeben: 0
Danke bekommen: 0 mal in 0 Post

Re: OMS in der Syntax

Beitragvon Lanin » Mo 8. Mai 2023, 13:23

Ohne je den OMS-Befehl genutzt zu haben: Das Syntaxdiagramm bietet neben

Code: Alles auswählen
/IF  COMMANDS = ["expression" "expression"...]
      SUBTYPES = ["expression" "expression"...]
      LABELS = ["expression" "expression"...]
      INSTANCES = [n n... LAST]


auch

Code: Alles auswählen
/EXCEPTIF (same keywords as IF, except for INSTANCES)


an. Hast Du es einmal damit probiert? M.E. sollte das für Deine Zwecke passen.
Lanin
 
Beiträge: 18
Registriert: Mo 29. Aug 2022, 14:29
Danke gegeben: 0
Danke bekommen: 0 mal in 0 Post

Re: OMS in der Syntax

Beitragvon doc_rolfo » Mo 8. Mai 2023, 17:25

Kann ich beide Befehle (also sowohl if als auch exeptif) gleichzeitig nutzen? Das würde natürlich helfen...

Aber wie kann ich für verschiedene objects die jeweiligen subtypes angeben? Wenn ich sie aufzähle:

Code: Alles auswählen
OMS
  /SELECT ALL EXCEPT = [HEADINGS LOGS WARNINGS ]
  /IF  COMMANDS=[Tables Frequencies] SUBTYPES=[Notes Frequencies].


geht nicht, denn hier wird es ja nicht klar, worauf sich die subtypes beziehen. Sauberer wäre es m.E. nach so:

Code: Alles auswählen
OMS
  /SELECT ALL EXCEPT = [HEADINGS LOGS WARNINGS ]
  /IF  COMMANDS=['Tables'] SUBTYPES=['Notes']
  /IF COMMANDS=['Frequencies'] SUBTYPES=['Frequencies'].


aber das nimmt er nicht an, weil 2x if nicht akzeptiert wird. Jemand schon mal mehrere Objekte mit jeweiligen Subtypes genutzt?
Gruß,
Doc Rolfo
doc_rolfo
 
Beiträge: 5
Registriert: Fr 24. Mär 2023, 12:55
Danke gegeben: 0
Danke bekommen: 0 mal in 0 Post

Re: OMS in der Syntax

Beitragvon Lanin » Di 9. Mai 2023, 11:53

Kann ich beide Befehle (also sowohl if als auch exeptif) gleichzeitig nutzen? Das würde natürlich helfen...


Grundsätzlich funktioniert das bei mir. Das untenstehende Beispiel etwa sorgt dafür, dass nur die Frequencies-Tabelle angezeigt wird, nicht aber Anmerkungen und Statistiken (Zusammenfassung der Fallverarbeitung). Lösche ich die Zeile /EXCEPTIF SUBTYPES = [' Notes' ' Statistics'], so werden diese hingegen angezeigt.

Code: Alles auswählen
OMS
  /SELECT ALL EXCEPT = [HEADINGS WARNINGS]
  /IF COMMANDS = ['Frequencies']
  /EXCEPTIF SUBTYPES = [' Notes' ' Statistics']
  /DESTINATION
   FORMAT = XLSX
   OUTFILE = 'test_OMS.xlsx'
   VIEWER=YES.
Fre v1.
crosstabs v1 by v2.
OMSEND.


Ggf. ist es aber so, dass COMMAND, SUBTYPE, LABELS nicht in beiden Unterbefehlen IF und EXCEPTIF benutzt werden können, hier müsstest Du rumprobieren. Die Schwierigkeit dürfte vermutlich sein, die Unterbefehle SELECT, IF und EXCEPTIF sinnvoll so zu kombinieren, dass diese sich nicht widersprechen und dennoch alle Anforderungen berücksichtigt werden.

Übrigens würde ich mir auch einmal Scripte anschauen, die im Installationsverzeichnis im Ordner "Samples" liegen, hierunter auch das Script "Clean Viever.wwd", das an unterschiedliche Elemente des Outputs angepasst und auch via Syntaxbefehl angesprochen werden kann (die Syntax wäre dann nach den Auswertungen und nach OMSEND einzufügen). Ggf. könnte auch dies helfen, die Anzahl möglicher Kombinationen einzuschränken.
Lanin
 
Beiträge: 18
Registriert: Mo 29. Aug 2022, 14:29
Danke gegeben: 0
Danke bekommen: 0 mal in 0 Post

Re: OMS in der Syntax

Beitragvon doc_rolfo » Mi 10. Mai 2023, 11:06

Hi Lanin,
ok, dann muss ich es weiter mit select, if und exceptif versuchen. Danke für die Spur... und den Tipp mit den Samples. Hab mal durchgeschaut, allerdings nicht das Skript gefunden, was du angesprochen hast. Hab auch mal die Skripte durchgeschaut, da aber auf Anhieb nichts passendes gefunden - werde hier aber nochmal genauer durchschauen.
Merci!
doc_rolfo
 
Beiträge: 5
Registriert: Fr 24. Mär 2023, 12:55
Danke gegeben: 0
Danke bekommen: 0 mal in 0 Post

Re: OMS in der Syntax

Beitragvon strukturmarionette » Mi 10. Mai 2023, 18:20

Hi,

.. \IBM\SPSS\SPSS Statistics\Samples

clean viewer.wwd
[ SPSS Statistics WinWrap Basic Script (.wwd) ]
__________________________________________
'PURPOSE
'This script "cleans up" the designated output document by finding
'and deleting Notes tables. You can easily modify the script to
'delete output items of a different type and label by changing the
'parameters set in the main procedure.

'ASSUMPTIONS
'The document you want to clean is displayed in the Output Viewer
'and is the currently designated output document.

'EFFECTS
'Deletes all Notes tables.

Option Explicit 'All variables must be declarated before being used

Sub Main
'The main procedure sets parameters to determine what
'output items get deleted, and then calls the
'SelectAndRemoveOutputItem procedure to do the real work.

'Declare variables for parameters

Dim intType As Integer 'Type of output item to delete, expressed as an integer
Dim strLabel As String 'Item label displayed in left pane of Output Viewer

intType = SPSSNote 'Type to delete. See help on "SpssType property" for valid types
'strLabel = "Notes" 'Label to delete

'********************************************************************
'You can edit the above lines to delete items of a different type.
'See help on the SpssType property for the complete list of types.
'Labels are case-sensitive (meaning that "Case Processing Summary"
'is not the same as "case processing summary")

'For example, to delete all Case Processing Summaries, specify:
'intType = SpssPivot
'strLabel = "Case Processing Summary"
'*********************************************************************

Call SelectAndRemoveOutputItem(intType, strLabel) 'Call procedure below with specified parameters

End Sub

Sub SelectAndRemoveOutputItem(intType As Integer, Optional strLabel As Variant)
'This procedure iterates through output items and deletes all output
'items that match the specified search type and label.

'Variable declarations

Dim objOutputDoc As ISpssOutputDoc
Dim objItems As ISpssItems
Dim objItem As ISpssItem
'By convention, object variable names begin With "obj".
'OutputDoc, ISpssItems, And ISpssItem are the names of SPSS object classes.
'For example, the first declaration above declares an object variable named
'"objOutputDoc" and assigns it to the OutputDoc Object
'class. Below, that variable is set to the designated output document
'in order to access the items in that output document.

Dim intCount As Integer 'total number of output items
Dim intIndex As Integer 'loop counter, corresponds index (position) of each item
Dim intCurrentType As Integer 'type for current item
Dim strCurrentLabel As String 'label for current item

Set objOutputDoc = objSpssApp.GetDesignatedOutputDoc
Set objItems = objOutputDoc.Items
'GetDesignatedOutputDoc is a method that returns the designated output
'document. After objOutputDoc is set to the designated output document,
'the Items method is used to access the items in that document.

intCount = objItems.Count 'Count method returns the number
'of output items in the designated document

objOutputDoc.ClearSelection 'Clear any existing selections to avoid deleting
'output items that happen to be selected before
'the script is run.

For intIndex = 0 To intCount - 1
'The loop repeats as many times as there are output items.
'The intIndex variable is used as a counter. intCount is the total
'number of items. Output items are numbered sequentially starting
'at 0. Thus if there are 9 output items they have index values from 0 to 8.

Set objItem = objItems.GetItem(intIndex)
'Get the item whose position corresponds the current index value

intCurrentType = objItem.SPSSType 'Returns type of current item
objItem.Current = True

'The first line below checks whether the current item matches
'the type to be deleted. If yes, then get the label of the current
'item and check that also. If the label matches (or is empty)
'then select the item.

If intCurrentType = intType Then
strCurrentLabel = objItem.Label
If strCurrentLabel = strLabel Or strLabel = "" Then
objItem.Selected = True
End If
End If
Next

objOutputDoc.Remove 'Delete all items selected by the FOR... NEXT loop above.

End Sub

Gruß
S.
strukturmarionette
 
Beiträge: 2454
Registriert: Sa 1. Okt 2011, 17:20
Danke gegeben: 7
Danke bekommen: 122 mal in 122 Posts

Re: OMS in der Syntax

Beitragvon doc_rolfo » Do 11. Mai 2023, 09:35

Oh wow, Danke!

wwd-Dateien kannte ich noch nicht! Ich hab mal geschaut und jetzt wird mir auch klar, warum: wwd steht für winwrap director - und ich arbeite mit SPSS auf dem Mac. Dementsprechend funktioniert das leider nicht für mich, aber ich habe mit der Anweisung

Code: Alles auswählen
OMS
  /SELECT ALL
  /EXCEPTIF SUBTYPES=['Notes']
  /DESTINATION VIEWER=YES
  FORMAT = XLSX
  OUTFILE = 'Downloads/SPSS-output_OMS.xlsx'.


ganz gute Erfolge, also mit Nutzung der Subtypes Notes ohne irgendwelche Objekte: dabei werden alle Notes-Sektionen ausgeblendet.
Gruß, Doc Rolfo

PS: ich hab mir schon den Wolf gesucht - aber wo findet man hier ein "Danke senden"?
doc_rolfo
 
Beiträge: 5
Registriert: Fr 24. Mär 2023, 12:55
Danke gegeben: 0
Danke bekommen: 0 mal in 0 Post


Zurück zu SPSS Syntax

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 2 Gäste

cron