Can't use GPL within Macro

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Can't use GPL within Macro

Xenia-3
The original code is:

"

!DO !TargetinAQUAScore !IN (!TargetinAQUAScores)
DESCRIPTIVES VARIABLES=!TargetinAQUAScore
  /STATISTICS=ALL.

* Heat Map Binning Scores -------------------------------------------------
-----------------.
compute !concat("BIN_",!TargetinAQUAScore)=0.
if (Missing(!TargetinAQUAScore )) !concat("BIN_",!TargetinAQUAScore)=0.
if (!FinalResult="Fail") !concat("BIN_",!TargetinAQUAScore)=0.
if (!TargetinAQUAScore >=0 and !TargetinAQUAScore <=256)  !concat("BIN_",!
TargetinAQUAScore)=1.
if (!TargetinAQUAScore > 256 and !TargetinAQUAScore <=512) !concat("BIN_",!
TargetinAQUAScore)=2.
if (!TargetinAQUAScore > 512 and !TargetinAQUAScore <=1024) !concat
("BIN_",!TargetinAQUAScore)=3.
if (!TargetinAQUAScore >1024 and !TargetinAQUAScore <=2048) !concat
("BIN_",!TargetinAQUAScore)=4.
if (!TargetinAQUAScore >2048 and !TargetinAQUAScore <=4096) !concat
("BIN_",!TargetinAQUAScore)=5.
if (!TargetinAQUAScore >4096 and !TargetinAQUAScore <=8192) !concat
("BIN_",!TargetinAQUAScore)=6.
if (!TargetinAQUAScore >8192 and !TargetinAQUAScore <=16384) !concat
("BIN_",!TargetinAQUAScore)=7.
if (!TargetinAQUAScore > 16384) !concat("BIN_",!TargetinAQUAScore)=8.
var lab !concat("BIN_",!TargetinAQUAScore) 'Bin Nuc Score Grouping'.
val lab !concat("BIN_",!TargetinAQUAScore) 0 'Excluded' 1 '<256' 2 '256-
512' 3 '512-1024' 4 '1024-2048' 5 '2048-4096' 6 '4096-8192' 7 '8192-16384'
8 '>16384'.
exe.

!LET !gdataset=!CONCAT('"',graphdataset,'"')


* Chart Builder.
GGRAPH
  /GRAPHDATASET NAME=!gdataset VARIABLES=!X !Y
  !concat("BIN_",!TargetinAQUAScore)[LEVEL=NOMINAL] MISSING=LISTWISE
  REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE
 TEMPLATE= ["P:\Core Projects\Cheetah\Cheetah\CEN-003 and CEN-004\Stage II
cohort stats\ChartSizeJC2.sgt"].
BEGIN GPL
 SOURCE: s=userSource(id(!gdataset))
 DATA: !X=col(source(s), name(!CONCAT('"',X,'"')))
 DATA: !Y=col(source(s), name(!CONCAT('"',Y,'"')))
 DATA: !concat("BIN_",!TargetinAQUAScore)=col(source(s), name( !concat
('"BIN_',!TargetinAQUAScore,'"')), unit.category())
 GUIDE: axis(dim(1), label(!quote(X)))
 GUIDE: axis(dim(2), label(!quote(Y)))
 GUIDE: legend(aesthetic(aesthetic.color.interior), label(concat("Bin ",!
TargetinAQUAScore), "Grouping"))
 SCALE: linear(dim(1), min(0), max(62))
 SCALE: linear(dim(2), reverse(), min(0), max(34))
 SCALE: cat(aesthetic(aesthetic.color.interior), include
(".00", "1.00", "2.00", "3.00", "4.00", "5.00", "6.00", "7.00", "8.00"))
 ELEMENT: point(position(!X*!Y), color.interior(!concat("BIN_",!
TargetinAQUAScore)), size(size."11px"))
END GPL.



!DOEND.
exe.

"





How to figure out the following error:

"
GPL error: algebra(axis(d)

Expecting ( or + or * or /: axis(d
GPL:
 SOURCE: s=userSource(id( "graphdataset" )) DATA: X1 =col(source(s), name
( "X" )) DATA: Y1 =col(source(s), name( "Y" )) DATA:
BIN_TargetinCytoplasmAQUA_Norm1 =col(source(s), name
( "BIN_TargetinCytoplasmAQUA_Norm1" ), unit.category()) GUIDE: axis(d

"

Seems SPSS didn't recognize out dim.
Thanks a lot.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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
Reply | Threaded
Open this post in threaded view
|

Re: Can't use GPL within Macro

ViAnn Beadle
Without seeing the actual syntax generated, I suspect that your problem is
in the GUIDE label functions. You need to use concat to quote the label
argument in the same way that you do it for the argument to the name
function in the DATA statements.

A macro generates apostrophes while GPL requires quotation marks. Yet
another reason to use Python rather than a macro;-)

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Xenia
Sent: Thursday, February 05, 2009 8:19 PM
To: [hidden email]
Subject: Can't use GPL within Macro

The original code is:

"

!DO !TargetinAQUAScore !IN (!TargetinAQUAScores)
DESCRIPTIVES VARIABLES=!TargetinAQUAScore
  /STATISTICS=ALL.

* Heat Map Binning Scores -------------------------------------------------
-----------------.
compute !concat("BIN_",!TargetinAQUAScore)=0.
if (Missing(!TargetinAQUAScore )) !concat("BIN_",!TargetinAQUAScore)=0.
if (!FinalResult="Fail") !concat("BIN_",!TargetinAQUAScore)=0.
if (!TargetinAQUAScore >=0 and !TargetinAQUAScore <=256)  !concat("BIN_",!
TargetinAQUAScore)=1.
if (!TargetinAQUAScore > 256 and !TargetinAQUAScore <=512) !concat("BIN_",!
TargetinAQUAScore)=2.
if (!TargetinAQUAScore > 512 and !TargetinAQUAScore <=1024) !concat
("BIN_",!TargetinAQUAScore)=3.
if (!TargetinAQUAScore >1024 and !TargetinAQUAScore <=2048) !concat
("BIN_",!TargetinAQUAScore)=4.
if (!TargetinAQUAScore >2048 and !TargetinAQUAScore <=4096) !concat
("BIN_",!TargetinAQUAScore)=5.
if (!TargetinAQUAScore >4096 and !TargetinAQUAScore <=8192) !concat
("BIN_",!TargetinAQUAScore)=6.
if (!TargetinAQUAScore >8192 and !TargetinAQUAScore <=16384) !concat
("BIN_",!TargetinAQUAScore)=7.
if (!TargetinAQUAScore > 16384) !concat("BIN_",!TargetinAQUAScore)=8.
var lab !concat("BIN_",!TargetinAQUAScore) 'Bin Nuc Score Grouping'.
val lab !concat("BIN_",!TargetinAQUAScore) 0 'Excluded' 1 '<256' 2 '256-
512' 3 '512-1024' 4 '1024-2048' 5 '2048-4096' 6 '4096-8192' 7 '8192-16384'
8 '>16384'.
exe.

!LET !gdataset=!CONCAT('"',graphdataset,'"')


* Chart Builder.
GGRAPH
  /GRAPHDATASET NAME=!gdataset VARIABLES=!X !Y
  !concat("BIN_",!TargetinAQUAScore)[LEVEL=NOMINAL] MISSING=LISTWISE
  REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE
 TEMPLATE= ["P:\Core Projects\Cheetah\Cheetah\CEN-003 and CEN-004\Stage II
cohort stats\ChartSizeJC2.sgt"].
BEGIN GPL
 SOURCE: s=userSource(id(!gdataset))
 DATA: !X=col(source(s), name(!CONCAT('"',X,'"')))
 DATA: !Y=col(source(s), name(!CONCAT('"',Y,'"')))
 DATA: !concat("BIN_",!TargetinAQUAScore)=col(source(s), name( !concat
('"BIN_',!TargetinAQUAScore,'"')), unit.category())
 GUIDE: axis(dim(1), label(!quote(X)))
 GUIDE: axis(dim(2), label(!quote(Y)))
 GUIDE: legend(aesthetic(aesthetic.color.interior), label(concat("Bin ",!
TargetinAQUAScore), "Grouping"))
 SCALE: linear(dim(1), min(0), max(62))
 SCALE: linear(dim(2), reverse(), min(0), max(34))
 SCALE: cat(aesthetic(aesthetic.color.interior), include
(".00", "1.00", "2.00", "3.00", "4.00", "5.00", "6.00", "7.00", "8.00"))
 ELEMENT: point(position(!X*!Y), color.interior(!concat("BIN_",!
TargetinAQUAScore)), size(size."11px"))
END GPL.



!DOEND.
exe.

"





How to figure out the following error:

"
GPL error: algebra(axis(d)

Expecting ( or + or * or /: axis(d
GPL:
 SOURCE: s=userSource(id( "graphdataset" )) DATA: X1 =col(source(s), name
( "X" )) DATA: Y1 =col(source(s), name( "Y" )) DATA:
BIN_TargetinCytoplasmAQUA_Norm1 =col(source(s), name
( "BIN_TargetinCytoplasmAQUA_Norm1" ), unit.category()) GUIDE: axis(d

"

Seems SPSS didn't recognize out dim.
Thanks a lot.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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