syntax question

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

syntax question

joost
Hi,

i have the following syntax:
UNIANOVA
  FS_L_G_SUPFR_CT  BY DIAGNOSIS  WITH AGE_MONTHS
  /METHOD = SSTYPE(3)
  /INTERCEPT = INCLUDE
  /EMMEANS = TABLES(DIAGNOSIS) WITH(AGE_MONTHS=MEAN) COMPARE ADJ(LSD)
  /PRINT = DESCRIPTIVE ETASQ OPOWER
  /CRITERIA = ALPHA(.05)
  /DESIGN = AGE_MONTHS DIAGNOSIS .

i want to repeat this analysis and for every repetition i want to replace
the variable "FS_L_G_SUPFR_CT" for another variable. i have many variables
and do not want repeat the code for every analysis.so, can a loop be
scripted that runs UNIANOVA for a list of variables?

best,
-joost

=====================
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: syntax question

Bruce Weaver
Administrator
You can stick it in a macro.

define !MyModel (Ylist = !cmdend)

!do !Y !in (!Ylist)
UNIANOVA
  !Y  BY DIAGNOSIS  WITH AGE_MONTHS
  /METHOD = SSTYPE(3)
  /INTERCEPT = INCLUDE
  /EMMEANS = TABLES(DIAGNOSIS) WITH(AGE_MONTHS=MEAN) COMPARE ADJ(LSD)
  /PRINT = DESCRIPTIVE ETASQ OPOWER
  /CRITERIA = ALPHA(.05)
  /DESIGN = AGE_MONTHS DIAGNOSIS .
!doend

!enddefine.

* Now call the macro, handing it a list of dependent variables .

!MyModel Ylist = Y1 Y2 Y3 .



joost wrote
Hi,

i have the following syntax:
UNIANOVA
  FS_L_G_SUPFR_CT  BY DIAGNOSIS  WITH AGE_MONTHS
  /METHOD = SSTYPE(3)
  /INTERCEPT = INCLUDE
  /EMMEANS = TABLES(DIAGNOSIS) WITH(AGE_MONTHS=MEAN) COMPARE ADJ(LSD)
  /PRINT = DESCRIPTIVE ETASQ OPOWER
  /CRITERIA = ALPHA(.05)
  /DESIGN = AGE_MONTHS DIAGNOSIS .

i want to repeat this analysis and for every repetition i want to replace
the variable "FS_L_G_SUPFR_CT" for another variable. i have many variables
and do not want repeat the code for every analysis.so, can a loop be
scripted that runs UNIANOVA for a list of variables?

best,
-joost

=====================
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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: syntax question

Edwin Meijdam-2
In reply to this post by joost
Hi Joost,

Perhaps this will works (untested):

define uniList (!POS !CHAREND('/'))
!DO !i !IN (!1)

UNIANOVA
 !i  BY DIAGNOSIS  WITH AGE_MONTHS
 /METHOD = SSTYPE(3)
 /INTERCEPT = INCLUDE
 /EMMEANS = TABLES(DIAGNOSIS) WITH(AGE_MONTHS=MEAN) COMPARE ADJ(LSD)
 /PRINT = DESCRIPTIVE ETASQ OPOWER
 /CRITERIA = ALPHA(.05)
 /DESIGN = AGE_MONTHS DIAGNOSIS .

!DOEND.
!ENDDEFINE.

* Run command.
uniList VAR1 VAR2 VAR3  /.

On Mon, Dec 12, 2011 at 1:27 PM, joost <[hidden email]> wrote:
Hi,

i have the following syntax:
UNIANOVA
 FS_L_G_SUPFR_CT  BY DIAGNOSIS  WITH AGE_MONTHS
 /METHOD = SSTYPE(3)
 /INTERCEPT = INCLUDE
 /EMMEANS = TABLES(DIAGNOSIS) WITH(AGE_MONTHS=MEAN) COMPARE ADJ(LSD)
 /PRINT = DESCRIPTIVE ETASQ OPOWER
 /CRITERIA = ALPHA(.05)
 /DESIGN = AGE_MONTHS DIAGNOSIS .

i want to repeat this analysis and for every repetition i want to replace
the variable "FS_L_G_SUPFR_CT" for another variable. i have many variables
and do not want repeat the code for every analysis.so, can a loop be
scripted that runs UNIANOVA for a list of variables?

best,
-joost

=====================
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



--
Edwin Meijdam
+31(0)6 159 608 37 

DASC B.V. 
Postbus 88 4130 EB Vianen
085 - 8774406
[hidden email]
http://www.linkedin.com/in/emeijdam

Reply | Threaded
Open this post in threaded view
|

Re: syntax question

David Marso
Administrator
In reply to this post by Bruce Weaver
Alternatively you could slaughter the data using VarsToCases followed by SORT and SPLIT FILE.
Using SPLIT FILE LAYERED keeps all related material from the collection of vars together.
OTOH: Isn't a multivariate approach generally preferable (statistically) to a slew of univariate analyses?
--
Example using one of the canned data files:
GET
  FILE='C:\Program Files\SPSS\1991 U.S. General Social Survey.sav'.
VARSTOCASES /ID = id
 /MAKE trans1 FROM sex race region life sibs childs age paeduc maeduc speduc
  prestg80 occcat80 tax usintl obey popular thnkself workhard helpoth hlth1
  hlth2 hlth3 hlth4 hlth5 hlth6 hlth7 hlth8 hlth9 work1 work2 work3 work4
  work5 work6 work7 work8 work9
 /INDEX = Index1(trans1)
 /KEEP =  educ happy
 /NULL = KEEP.
SORT CASES BY Index1.
SPLIT FILE LAYERED BY index1.
UNIANOVA
  TRANS1 BY educ  WITH happy
  /METHOD = SSTYPE(3)
  /INTERCEPT = INCLUDE
  /EMMEANS = TABLES(educ) WITH(happy=MEAN) COMPARE ADJ(LSD)
  /PRINT = DESCRIPTIVE ETASQ OPOWER
  /CRITERIA = ALPHA(.05)
  /DESIGN = educ happy .

Bruce Weaver wrote
You can stick it in a macro.

define !MyModel (Ylist = !cmdend)

!do !Y !in (!Ylist)
UNIANOVA
  !Y  BY DIAGNOSIS  WITH AGE_MONTHS
  /METHOD = SSTYPE(3)
  /INTERCEPT = INCLUDE
  /EMMEANS = TABLES(DIAGNOSIS) WITH(AGE_MONTHS=MEAN) COMPARE ADJ(LSD)
  /PRINT = DESCRIPTIVE ETASQ OPOWER
  /CRITERIA = ALPHA(.05)
  /DESIGN = AGE_MONTHS DIAGNOSIS .
!doend

!enddefine.

* Now call the macro, handing it a list of dependent variables .

!MyModel Ylist = Y1 Y2 Y3 .



joost wrote
Hi,

i have the following syntax:
UNIANOVA
  FS_L_G_SUPFR_CT  BY DIAGNOSIS  WITH AGE_MONTHS
  /METHOD = SSTYPE(3)
  /INTERCEPT = INCLUDE
  /EMMEANS = TABLES(DIAGNOSIS) WITH(AGE_MONTHS=MEAN) COMPARE ADJ(LSD)
  /PRINT = DESCRIPTIVE ETASQ OPOWER
  /CRITERIA = ALPHA(.05)
  /DESIGN = AGE_MONTHS DIAGNOSIS .

i want to repeat this analysis and for every repetition i want to replace
the variable "FS_L_G_SUPFR_CT" for another variable. i have many variables
and do not want repeat the code for every analysis.so, can a loop be
scripted that runs UNIANOVA for a list of variables?

best,
-joost

=====================
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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: syntax question

Leah Girshkin
In reply to this post by Bruce Weaver
Thanks!  That worked perfectly for me.  Can't believe it was so hard to find this thread, such a useful thing to be able to do.


>>>
You can stick it in a macro.

define !MyModel (Ylist = !cmdend)

!do !Y !in (!Ylist)
UNIANOVA
  !Y  BY DIAGNOSIS  WITH AGE_MONTHS
  /METHOD = SSTYPE(3)
  /INTERCEPT = INCLUDE
  /EMMEANS = TABLES(DIAGNOSIS) WITH(AGE_MONTHS=MEAN) COMPARE ADJ(LSD)
  /PRINT = DESCRIPTIVE ETASQ OPOWER
  /CRITERIA = ALPHA(.05)
  /DESIGN = AGE_MONTHS DIAGNOSIS .
!doend

!enddefine.

* Now call the macro, handing it a list of dependent variables .

!MyModel Ylist = Y1 Y2 Y3 .