Date: Wed, 15 Feb 2006 09:38:15 -0600
Reply-To: "Peck, Jon" <email@example.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Peck, Jon" <firstname.lastname@example.org>
Subject: Re: Set table/col width in syntax
Content-Type: text/plain; charset="utf-8"
Unfortunately, 255 is the maximum line size that SPSS currently supports. Longer than that would be pretty hard to read or print, though.
If you want to write long lines of comments to a file, and you have SPSS 14.0.1, the following short program shows how to do this with no length limit. The lines are numbered only for reference in the comments that follow. Don't enter them.
1 begin program.
2 import spss, spssdata
3 f = open("c:/temp/myoutput.txt", "w")
4 cursor = spssdata.Spssdata()
5 for case in cursor:
6 print >>f, case.comments.rstrip()
9 end program.
Lines 1 and 9 demarcate PROGRAM mode, within which the code is written in Python*
Line 2 get the spss module, standard when programmability is installed, and the spssdata module, which can be downloaded from the SPSS Code Center. Support for fetching the case data was added in SPSS 14.0.1.
Line 3 opens a file for output. Note the use of forward slashes in the path.
Line 4 gets a cursor to the case data that will be used to fetch all the variables. You could use
Cursor = spssdata.Spssdata(indexes=['comments'])
To retrieve only the variable named comments
Line 5 loops over the cases in the file.
Line 6 prints the values of the comments variable to the file after removing any trailing blanks. Of course, other variables and formats could be included.
Lines 7 and 8 clean up.
*NOTE: SPSS is not the owner or licensor of the Python software. Any user of Python must agree to the terms of the Python license agreement located on the Python web site. SPSS is not making any statement about the quality of the Python program. SPSS fully disclaims all liability associated with your use of the Python program.
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Christoph Hermann
Sent: Wednesday, February 15, 2006 8:49 AM
Subject: Re: [SPSSX-L] Set table/col width in syntax
Peck, Jon schrieb:
> Is there a way to do the same for the "list" output? (Text output is
> truncated after x chars, i want it unlimited.)
> If you mean the output for the LIST command, you can change the
> default to be as large as 255 via SET WIDTH=255 or
> the equivalent in the Edit/Options/Viewer or Draft Viewer tabs.
Yes, i already did that, but i want it larger than 255 chars (if
possible). I have strings (User comments) that may be up to 5000chars
long, and i want to display a list of these comments.
Currently i display a FREQUENCIES, but a simple list would be much
nicer. The problem is, that with LIST my strings get cut.