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
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
Simple and Great..
For more detail information about COMMENT available in SPSSBASE.pdf.
page number 267.
Thanks,
Lawrence.
Thanks
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
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
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