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 2011)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 20 Dec 2011 14:09:25 -0500
Reply-To:     Rich Ulrich <rich-ulrich@live.com>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Rich Ulrich <rich-ulrich@live.com>
Subject:      Re: macro to replace portions of variable names in syntax file
Comments: To: mpirritano@ochca.com
In-Reply-To:  <A715D7E005BF1C4D8505CA3CABB748F206D29754@HCAMAIL03.ochca.com>
Content-Type: multipart/alternative;

Read a template, substitute for some text, write the result somewhere and then run it. That's the way that I read the original post.

My old-style solution still looks pretty easy, compared to what I've read, which mostly tackle other problems.

The text substitution can be more complicated than I wrote -- when the new and old are not exactly the same length, you have to copy the old line into a new line before writing it, to accommodate a longer or shorter text.

-- Rich Ulrich

> Date: Tue, 20 Dec 2011 08:31:23 -0800 > From: MPirritano@ochca.com > Subject: Re: macro to replace portions of variable names in syntax file > To: SPSSX-L@LISTSERV.UGA.EDU > > David et al., > > Apologies if my original post wasn't clear. I think Jon and Albert-Jan > were on the right track. I have yet to try Albert-Jan's solution. > > What I want is simply a constant. > > Like in python I could just say: > > X = "Hello" > > And then plug that in wherever else I want in the syntax. To be able to > use a constant that is not expressly a string, like Sep_Oct_2011 (no > quotes), as part of a variable name. So that I could just say X = > Sep_Oct_2011 and then plug X in wherever I wanted to do the replacement. > That is what I was using the macro syntax to define my file dates as. I > don't need to parse the date string to equal anything. 20111219 doesn't > have to equal Nov_Dec_2011. In fact it was silly of me to call my > variable MMM_MMM_YYYY. I changed it from Sep_Oct_2011 to 090111_103111, > for my sep to oct file name. I prefer YYYYMMDD, but the person who is > sending me files uses MMDDYY. > [snip, previous]


[text/html]


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