Macro for GLM

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

Macro for GLM

ecottrell
I have about 15 outcome measures/variables I'm running the following syntax
on:

GLM var.1 var.2 var.3 var.4
  /WSFACTOR = time 4
  /WSDESIGN=time
  /EMMEANS=tables( time)
  /PLOT = profile( time).


I was hoping to make a macro to speed it up (and shorten the syntax) but I
can't figure out how to to get it to run. I tried doing !var.1 (since all
the variables are name.1 name.2 name.3 name.4) but I just get errors.


The full syntax I'm attempting to use:

* Encoding: UTF-8.
DEFINE !Alt_Test (VarLIST !ENCLOSE("(",")"))

!do !Var !in (!VarList)

GLM !var.1 !var.2 !var.3 !var.4
  /WSFACTOR = time 4
  /WSDESIGN=time
  /EMMEANS=tables( time)
  /PLOT = profile( time).

!doend

!ENDDEFINE.

!Alt_Test VarLIST ( name portion of all my variables before the .#)



I'm using SPSS if that makes a difference.  Also if it makes a difference, I
eventually want to also run it with other variables:


GLM !var.1 !var.2 !var.3 !var.4 BY !VARIABLE2
  /WSFACTOR = time 4
  /WSDESIGN=time
  /DESIGN=!VARIABLE2
  /EMMEANS=tables( time*!VARIABLE2)
  /PLOT = profile( time*!VARIABLE2).

But I think I can figure out how to assign two variables if I can figure out
how to deal with the first one.

Thank you so much for any assistance. I tried googling, and tried
spsstools.net but couldn't find anything that explains what to do (and
hopefully why).



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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: Macro for GLM

spss.giesel@yahoo.de
I've got no SPSS here but you can probably do it like this:

* --------------------------------------------------.
DEFINE !Alt_Test(dv = !TOKENS(1) /iv = !CMDEND)
!DO !stem !IN (!iv)
!LET !v1 = !CONCAT(!stem,".1")
!LET !v2 = !CONCAT(!stem,".2")
!LET !v3 = !CONCAT(!stem,".3")
!LET !v4 = !CONCAT(!stem,".4")
GLM !v1 !v2 !v3 !v4 BY !dv
  /WSFACTOR = time 4 
  /WSDESIGN=time
  /DESIGN=!VARIABLE2
  /EMMEANS=tables( time*!dv)
!DOEND  
!ENDDEFINE.
* --------------------------------------------------.
  
!Alt_Test 
dv = depvar 
iv = iv1 iv2 iv3 iv4 iv5 iv6 iv7 iv8 iv9 iv10 iv11 iv12 iv13 iv14 iv15.



Mario Giesel
Munich, Germany


Am Samstag, 24. August 2019, 18:12:07 MESZ hat ecottrell <[hidden email]> Folgendes geschrieben:


I have about 15 outcome measures/variables I'm running the following syntax
on:

GLM var.1 var.2 var.3 var.4
  /WSFACTOR = time 4
  /WSDESIGN=time
  /EMMEANS=tables( time)
  /PLOT = profile( time).


I was hoping to make a macro to speed it up (and shorten the syntax) but I
can't figure out how to to get it to run. I tried doing !var.1 (since all
the variables are name.1 name.2 name.3 name.4) but I just get errors.


The full syntax I'm attempting to use:

* Encoding: UTF-8.
DEFINE !Alt_Test (VarLIST !ENCLOSE("(",")"))

!do !Var !in (!VarList)

GLM !var.1 !var.2 !var.3 !var.4
  /WSFACTOR = time 4
  /WSDESIGN=time
  /EMMEANS=tables( time)
  /PLOT = profile( time).

!doend

!ENDDEFINE.

!Alt_Test VarLIST ( name portion of all my variables before the .#)



I'm using SPSS if that makes a difference.  Also if it makes a difference, I
eventually want to also run it with other variables:


GLM !var.1 !var.2 !var.3 !var.4 BY !VARIABLE2
  /WSFACTOR = time 4
  /WSDESIGN=time
  /DESIGN=!VARIABLE2
  /EMMEANS=tables( time*!VARIABLE2)
  /PLOT = profile( time*!VARIABLE2).

But I think I can figure out how to assign two variables if I can figure out
how to deal with the first one.

Thank you so much for any assistance. I tried googling, and tried
spsstools.net but couldn't find anything that explains what to do (and
hopefully why).



--

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Macro for GLM

spss.giesel@yahoo.de
Sorry, there's a dot missing above:

* --------------------------------------------------.
DEFINE !Alt_Test(dv = !TOKENS(1) /iv = !CMDEND)
!DO !stem !IN (!iv)
!LET !v1 = !CONCAT(!stem,".1")
!LET !v2 = !CONCAT(!stem,".2")
!LET !v3 = !CONCAT(!stem,".3")
!LET !v4 = !CONCAT(!stem,".4")
GLM !v1 !v2 !v3 !v4 BY !dv
  /WSFACTOR = time 4 
  /WSDESIGN=time
  /DESIGN=!VARIABLE2
  /EMMEANS=tables( time*!dv).
!DOEND  
!ENDDEFINE.
* --------------------------------------------------.
  
!Alt_Test 
dv = depvar 
iv = iv1 iv2 iv3 iv4 iv5 iv6 iv7 iv8 iv9 iv10 iv11 iv12 iv13 iv14 iv15.



Mario Giesel
Munich, Germany


Am Samstag, 24. August 2019, 21:53:45 MESZ hat Mario Giesel <[hidden email]> Folgendes geschrieben:


I've got no SPSS here but you can probably do it like this:

* --------------------------------------------------.
DEFINE !Alt_Test(dv = !TOKENS(1) /iv = !CMDEND)
!DO !stem !IN (!iv)
!LET !v1 = !CONCAT(!stem,".1")
!LET !v2 = !CONCAT(!stem,".2")
!LET !v3 = !CONCAT(!stem,".3")
!LET !v4 = !CONCAT(!stem,".4")
GLM !v1 !v2 !v3 !v4 BY !dv
  /WSFACTOR = time 4 
  /WSDESIGN=time
  /DESIGN=!VARIABLE2
  /EMMEANS=tables( time*!dv)
!DOEND  
!ENDDEFINE.
* --------------------------------------------------.
  
!Alt_Test 
dv = depvar 
iv = iv1 iv2 iv3 iv4 iv5 iv6 iv7 iv8 iv9 iv10 iv11 iv12 iv13 iv14 iv15.



Mario Giesel
Munich, Germany


Am Samstag, 24. August 2019, 18:12:07 MESZ hat ecottrell <[hidden email]> Folgendes geschrieben:


I have about 15 outcome measures/variables I'm running the following syntax
on:

GLM var.1 var.2 var.3 var.4
  /WSFACTOR = time 4
  /WSDESIGN=time
  /EMMEANS=tables( time)
  /PLOT = profile( time).


I was hoping to make a macro to speed it up (and shorten the syntax) but I
can't figure out how to to get it to run. I tried doing !var.1 (since all
the variables are name.1 name.2 name.3 name.4) but I just get errors.


The full syntax I'm attempting to use:

* Encoding: UTF-8.
DEFINE !Alt_Test (VarLIST !ENCLOSE("(",")"))

!do !Var !in (!VarList)

GLM !var.1 !var.2 !var.3 !var.4
  /WSFACTOR = time 4
  /WSDESIGN=time
  /EMMEANS=tables( time)
  /PLOT = profile( time).

!doend

!ENDDEFINE.

!Alt_Test VarLIST ( name portion of all my variables before the .#)



I'm using SPSS if that makes a difference.  Also if it makes a difference, I
eventually want to also run it with other variables:


GLM !var.1 !var.2 !var.3 !var.4 BY !VARIABLE2
  /WSFACTOR = time 4
  /WSDESIGN=time
  /DESIGN=!VARIABLE2
  /EMMEANS=tables( time*!VARIABLE2)
  /PLOT = profile( time*!VARIABLE2).

But I think I can figure out how to assign two variables if I can figure out
how to deal with the first one.

Thank you so much for any assistance. I tried googling, and tried
spsstools.net but couldn't find anything that explains what to do (and
hopefully why).



--

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Macro for GLM

ecottrell
Thank you!



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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: Macro for GLM

Bruce Weaver
Administrator
In reply to this post by spss.giesel@yahoo.de
Nice stuff, Mario.  But your IV and DV labels need to be switched, do they
not?  E.g., in GLM syntax, you should have a list of DV measurements
followed BY categorical IV. E.g.,

GLM Y1 Y2 Y3 Y4 BY Group
  /WSFACTOR = time 4
  /WSDESIGN=time
  /DESIGN=Group
  /EMMEANS=tables( time*Group).

Here, Y1-Y4 are 4 measurements of the DV (at different times), and Group is
the IV, not the DV.

HTH.


Mario Giesel-2 wrote

> Sorry, there's a dot missing above:
> * --------------------------------------------------.DEFINE !Alt_Test(dv =
> !TOKENS(1) /iv = !CMDEND)!DO !stem !IN (!iv)!LET !v1 =
> !CONCAT(!stem,".1")!LET !v2 = !CONCAT(!stem,".2")!LET !v3 =
> !CONCAT(!stem,".3")!LET !v4 = !CONCAT(!stem,".4")GLM !v1 !v2 !v3 !v4 BY
> !dv  /WSFACTOR = time 4   /WSDESIGN=time  /DESIGN=!VARIABLE2 
> /EMMEANS=tables( time*!dv).!DOEND  !ENDDEFINE.*
> --------------------------------------------------.  !Alt_Test dv =
> depvar iv = iv1 iv2 iv3 iv4 iv5 iv6 iv7 iv8 iv9 iv10 iv11 iv12 iv13 iv14
> iv15.
>
>
> Mario GieselMunich, Germany
>
>     Am Samstag, 24. August 2019, 21:53:45 MESZ hat Mario Giesel &lt;

> spss.giesel@

> &gt; Folgendes geschrieben:  
>  
>  I've got no SPSS here but you can probably do it like this:
> * --------------------------------------------------.DEFINE !Alt_Test(dv =
> !TOKENS(1) /iv = !CMDEND)!DO !stem !IN (!iv)!LET !v1 =
> !CONCAT(!stem,".1")!LET !v2 = !CONCAT(!stem,".2")!LET !v3 =
> !CONCAT(!stem,".3")!LET !v4 = !CONCAT(!stem,".4")GLM !v1 !v2 !v3 !v4 BY
> !dv  /WSFACTOR = time 4   /WSDESIGN=time  /DESIGN=!VARIABLE2 
> /EMMEANS=tables( time*!dv)!DOEND  !ENDDEFINE.*
> --------------------------------------------------.  !Alt_Test dv =
> depvar iv = iv1 iv2 iv3 iv4 iv5 iv6 iv7 iv8 iv9 iv10 iv11 iv12 iv13 iv14
> iv15.
>
>
> Mario GieselMunich, Germany
>
>     Am Samstag, 24. August 2019, 18:12:07 MESZ hat ecottrell &lt;

> ecottrell@

> &gt; Folgendes geschrieben:  
>  
>  I have about 15 outcome measures/variables I'm running the following
> syntax
> on:
>
> GLM var.1 var.2 var.3 var.4
>   /WSFACTOR = time 4
>   /WSDESIGN=time
>   /EMMEANS=tables( time)
>   /PLOT = profile( time).
>
>
> I was hoping to make a macro to speed it up (and shorten the syntax) but I
> can't figure out how to to get it to run. I tried doing !var.1 (since all
> the variables are name.1 name.2 name.3 name.4) but I just get errors.
>
>
> The full syntax I'm attempting to use:
>
> * Encoding: UTF-8.
> DEFINE !Alt_Test (VarLIST !ENCLOSE("(",")"))
>
> !do !Var !in (!VarList)
>
> GLM !var.1 !var.2 !var.3 !var.4
>   /WSFACTOR = time 4
>   /WSDESIGN=time
>   /EMMEANS=tables( time)
>   /PLOT = profile( time).
>
> !doend
>
> !ENDDEFINE.
>
> !Alt_Test VarLIST ( name portion of all my variables before the .#)
>
>
>
> I'm using SPSS if that makes a difference.  Also if it makes a difference,
> I
> eventually want to also run it with other variables:
>
>
> GLM !var.1 !var.2 !var.3 !var.4 BY !VARIABLE2
>   /WSFACTOR = time 4
>   /WSDESIGN=time
>   /DESIGN=!VARIABLE2
>   /EMMEANS=tables( time*!VARIABLE2)
>   /PLOT = profile( time*!VARIABLE2).
>
> But I think I can figure out how to assign two variables if I can figure
> out
> how to deal with the first one.
>
> Thank you so much for any assistance. I tried googling, and tried
> spsstools.net but couldn't find anything that explains what to do (and
> hopefully why).
>
>
>
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

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

> LISTSERV@.UGA

>  (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
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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/).