Google Groupes n'accepte plus les nouveaux posts ni abonnements Usenet. Les contenus de l'historique resteront visibles.

How to insert a comment into output via syntax?

4 154 vues
Accéder directement au premier message non lu

Karovaldas

non lue,
12 oct. 2006, 18:18:0912/10/2006
à
I like annotating my output and work primarily from syntax. I would
like to be able to describe the analyses as they are run. Is there a
way to insert SPSS text into the output form Syntax. I would like to
do something like this:

TEXT 'Here is what the following output is all about' .

I use TITLE and SUBTITLE extensively but they don't have enough space
for my purposes. ECHO only works if one does not use printback, which
does not work for me. I normally print syntax prior to each output,
but keep it hidden and only open it as needed. Plus, ECHO seems to be
limited to the line width and does not allow multiple lines.

So, is there a way to insert SPSS Text from syntax? If so, what is the
command? I can't seem to find it.

Thanks,
Haris

Haris

non lue,
12 oct. 2006, 18:18:5012/10/2006
à

Richard Ulrich

non lue,
13 oct. 2006, 16:42:0013/10/2006
à

COMMENT this is
your comment .

Be sure to end with a period or an extra blank line -- it is
really annoying to discover that something doesn't work
because it was considered as part of a preceding 'comment'.

--
Rich Ulrich, wpi...@pitt.edu

http://www.pitt.edu/~wpilib/index.html

Lawrence

non lue,
14 oct. 2006, 07:16:5214/10/2006
à
Thanks Richard,

Simple and Great..

For more detail information about COMMENT available in SPSSBASE.pdf.
page number 267.

Thanks,

Lawrence.

Haris

non lue,
14 oct. 2006, 21:31:3714/10/2006
à
COMMENT outputs as SPSS Log in the output and does not ouput anything
if you SET PRINTBACK to OFF. I am still looking for a way to output
"SPSS Text" not "Log." Anybody know if this is possible or is SPSS
Text only available via pull-down menus?

Thanks

Le message a été supprimé

Haris

non lue,
17 oct. 2006, 00:00:0117/10/2006
à
Response from SPSS Tech Support was that currently there is no way to
insert SPSS Text object into output via syntax.

JKPeck

non lue,
17 oct. 2006, 08:22:1117/10/2006
à
If you have SPSS 15 with programmability installed, this can be done
pretty easily.

Run the following code (it could be included via an INSERT command)
begin program.
import spss
def printcomment(text):
"Insert text into Viewer as a text block"
spss.StartProcedure("Comment")
spss.TextBlock("Comment", text)
spss.EndProcedure()
end program.


Then whenever you want to insert a comment, do something like this:
begin program.
printcomment("""here are some thoughts
about my analysis so far.
It appears that inserting comments works pretty well.""")
end program.

The only condition is that you must have a dataset open when you run
this. The Viewer outline pane will show "Comment" as the outline
entry.

The text in the example was enclosed in triple quotes to allow it to
span multiple lines. The line breaks are preserved in the output.
HTH,
Jon Peck

Something similar can be done with SPSS 14 using the viewer module

King

non lue,
18 oct. 2006, 11:37:1018/10/2006
à
Jon,

Is spss.StartProcedrue a recent addition to the spss module? I can't
get this to work. I get this error message:

AttributeError: 'module' object has no attribute 'StartProcedure'

Thanks,

King

JKPeck

non lue,
19 oct. 2006, 08:07:4319/10/2006
à
Yes, the StartProcedure api is new in SPSS 15. It is part of the
structure that gives programmability code access to the core functions
that standard SPSS procedures use to access and modify data and create
pivot tables and text blocks.

However, with SPSS 14 you can do something almost equivalent using the
view module. Here are docstrings from teh ViewerText class in that
module:

class ViewerText(object):

"""This class provides methods for creating a new text block in the
SPSS Viewer.
These methods will not work in distributed mode, and these items
are not subject to
manipulation by OMS.

This class does not work with SPSS 14.0.1 or 14.0.0 because of a
problem with the
InsertTitle automation method. However, it does work with SPSS
14.0.2."""

def insert(self, viewer, afteritem=None):
"""Insert the text object in the Viewer designated by viewer.
If afteritem is None
the item is inserted after the current item, otherwise, it
indicates the index
of the item after which the item is to be inserted. The index
is automatically
bounded by the number of items in the Viewer.

The item is always inserted at the highest level in the outline
except that if
the chosen location cannot be promoted, the insertion happens
at that level.
The return value is the index of the inserted item."""

-Jon Peck
SPSS

Santiago Sotelo

non lue,
2 mars 2021, 22:53:4402/03/2021
à
ECHO works perfectly fine.

Arnaldo Ferrari Nasi

non lue,
26 janv. 2023, 02:44:2326/01/2023
à

string MESSAGE (a1000).
compute MESSAGE = "This is a trick to swindle SPSS".
exe.
temp.
sel if ($casenum =1).
list MESSAGE.
delete variable MESSAGE.
0 nouveau message