I hate macro, but I don't like to see people suffer. Here's a nonmacro Python equivalent (untested). An expression like %(group1)s means to substitute the text in the variable group1 at that point in the literal, so here that would expand to g1. begin program. import spss, sys def dograph(): dependent = sys.argv[1] group1 = sys.argv[2] group2 = sys.argv[3] spss.Submit("""GRAPH /SCATTERPLOT(OVERLAY)= %(group2)s WITH %(group1)s_Frequency%(group2)s_Frequency) (pair) /MISSING=LISTWISE /TITLE="Normalized Distribution of %(dependent)s by %(group1)s and %(group2)s" """ %locals()) end program. SPSSINC PROGRAM dograph z g1 g2. On Thu, Jan 3, 2019 at 7:56 PM Dates, Brian <[hidden email]> wrote:
|
Thanks again, Jon. I've used both, and I'm going to go with the Python equivalent. It's cleaner throughout the entire computation process, which precedes the graphing. I hadn't thought of that.
Brian
From: Jon Peck <[hidden email]>
Sent: Thursday, January 3, 2019 10:16:53 PM To: Dates, Brian Cc: SPSS List Subject: Re: [SPSSX-L] Can I add a Graph Title with a Macro? I hate macro, but I don't like to see people suffer.
Here's a nonmacro Python equivalent (untested). An expression like %(group1)s means to substitute the text in the variable group1 at that point in the literal, so here that would expand to g1.
begin program.
import spss, sys
def dograph():
dependent = sys.argv[1]
group1 = sys.argv[2]
group2 = sys.argv[3]
spss.Submit("""GRAPH
/SCATTERPLOT(OVERLAY)= %(group2)s WITH %(group1)s_Frequency%(group2)s_Frequency) (pair)
/MISSING=LISTWISE
/TITLE="Normalized Distribution of %(dependent)s by %(group1)s and %(group2)s" """ %locals())
end program.
SPSSINC PROGRAM dograph z g1 g2.
On Thu, Jan 3, 2019 at 7:56 PM Dates, Brian <[hidden email]> wrote:
|
Free forum by Nabble | Edit this page |