Date: Thu, 14 Jul 2011 11:12:22 -0700
Reply-To: Albert-Jan Roskam <fomcl@yahoo.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Albert-Jan Roskam <fomcl@yahoo.com>
Subject: Re: Somebody who knows much about macros???
In-Reply-To: <1310663097317-4587482.post@n5.nabble.com>
Content-Type: multipart/alternative;
:-)) Perhaps you're right, but most of the clunky code is in the comment (which is not generated with the pure-syntax loop. Also, the pure-syntax code Bruce posted has two loops, with the busiest loop being the outer loop. I wonder which code is faster (not that it matters if it's just a few ms ;-).
Cheers!!
Albert-Jan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- On Thu, 7/14/11, David Marso <david.marso@gmail.com> wrote:
From: David Marso <david.marso@gmail.com>
Subject: Re: [SPSSX-L] Somebody who knows much about macros???
To: SPSSX-L@LISTSERV.UGA.EDU
Date: Thursday, July 14, 2011, 7:04 PM
WOW! This is so much easier to understand than the simple VECTOR/LOOP ;-)
GACK! Albert-Jan. Sometimes Python has its place (eg requiring dictionary
info/data cursors etc), but this is probably one of those everything looks
like a nail when you have a hammer situations.
>BEGIN PROGRAM.
>import os
>import spss
>sep = os.linesep
>cmds = ""
>for n in range(0, 400):
> if n > 0 and n % 5 != 0:
> cmd = "IF( MISSING(T%dEQ5DNL) ) T%dEQ5DNL = T%dEQ5DNL.%s" % (n, n,
> n-1, sep)
> else:
> cmd = "*" + 50 * "-" + ".%s* New block (%d-%d).%s" % (sep, n, n+4,
> sep) + "*" + 50 * "-" + >".%s" % sep
> cmds += cmd
>spss.Submit(cmds)
>END PROGRAM.
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Somebody-who-knows-much-about-macros-tp4586587p4587482.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
[text/html]
|