Date: Tue, 20 Dec 2011 11:18:13 -0800
Reply-To: "Pirritano, Matthew" <MPirritano@ochca.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Pirritano, Matthew" <MPirritano@ochca.com>
Subject: Re: macro to replace portions of variable names in syntax file
I'm not sure I'm clear on what people are calling a template. Is there
an actual spss syntax file custom template? Or do you just mean a
template in the generic sense of a preset file format? Or is it
Are you talking about doing text substitution using python? Or are you
talking about an old-style spss macro? Or doing find-replace?
I guess I wasn't too clear on the procedure you were describing. If it's
not too much to ask, could you provide a little more detail?
Matthew Pirritano, Ph.D.
Research Analyst IV
Medical Services Initiative (MSI)
Orange County Health Care Agency
From: Rich Ulrich [mailto:firstname.lastname@example.org]
Sent: Tuesday, December 20, 2011 11:09 AM
To: Pirritano, Matthew; SPSS list
Subject: RE: macro to replace portions of variable names in syntax file
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
and old are not exactly the same length, you have to copy the old line
a new line before writing it, to accommodate a longer or shorter text.
> Date: Tue, 20 Dec 2011 08:31:23 -0800
> From: MPirritano@ochca.com
> Subject: Re: macro to replace portions of variable names in syntax
> 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
> 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
> That is what I was using the macro syntax to define my file dates as.
> don't need to parse the date string to equal anything. 20111219
> 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
> for my sep to oct file name. I prefer YYYYMMDD, but the person who is
> sending me files uses MMDDYY.