LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2002)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 19 Dec 2002 15:44:13 -0600
Reply-To:     Carol Albright <calbright@visi.com>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Carol Albright <calbright@visi.com>
Subject:      Automating Search & Replace within Syntax File - Summary
In-Reply-To:  <995B47168FDCD211A0A7009027457F8408CE35EA@arfems.camh.net>
Content-Type: text/plain; charset="us-ascii"

Hi, Listers,

Here's my very belated THANKS! to Mahbub Khandoker, Mark Cassaza, & Art Kendall & all for their ideas. I had also whined to my husband, who whipped up a Python script. If you feed the script a CSV (comma-separated file) with the old text in the first column, and the new text in the second column, it will walk through your file, searching for the text in column 1 and replacing with what's in column 2.

(I realized I couldn't just rename my variables to match my existing syntax as I need to keep the names between timepoints discrete in order to do paired t-tests (i.e. compare this question from the pretest to its mate at follow-up).

I posted the script, how to use it and a sample run at: http://www.tc.umn.edu/~syzygy/Search_and_Replace_Python_Script.html

Here's a quick summary of editing software or search & replace features people sent:

Mahbub Khandoker suggested these two:

1) http://www.htmlworkshop.com/srhtml98.html 2) http://www.ctssn.com/linux/perlReplacementScript.html

Mark suggested trying these editors: 1) Ultra Edit: http://www.ultraedit.com/, a text editor, you can record macros. 2) "Cool Edit" http://www.syntrillium.com/

(my original problem: Hi, SPSS Listers!

Ouch, ouch! Why do survey researchers rearrange their questions between the pretest, post-test and followup? The fastest way I've found to adapt syntax written for one version, say to compute a new variable or create a scale, is to make a copy of the original syntax, then use search and replace.

Over, and over, and over again: Q23 becomes P15, q24 becomes P16, etc etc. Meanwhile my hand goes numb from the repetitive motion.

Anybody have a program or trick where I could feed the 'program' two lists of variable names, and the program successively searches for the item in List A in my syntax file and replaces that text string with its counterpart from List B. I suspect it'd need to be a script or even non-SPSS. I'm not script-literate, so didn't know where to start.)

Happy holidays, Carol ------------------------------------------------------------------------- Carol L. Albright, MS | E-Mail : calbright@visi.com Albright Consulting | Phone : 651/699-7218 St. Paul, MN 55105 USA | Research data services http://www.tc.umn.edu/~syzygy -------------------------------------------------------------------------


Back to: Top of message | Previous page | Main SPSSX-L page