How to repeat a section of syntax

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

How to repeat a section of syntax

D.R. Wahlgren
Gang,
I want to create a single line graph for each participant in my data
set.  The data are in long format, necessitated by the particular
GGRAPH commands I'm using.

My current approach is to create a temporary copy of the dataset
using DATASET COPY, use SELECT IF to reduce to a single ID#, then run
the graph, then close the dataset.   I've copied this set of syntax
as many times as I have participants in the data file, replacing the
ID# used in the SELECT IF command in each batch.

(Incidentally, I cannot use a TEMP command for the SELECT IF, because
the graph syntax is comprised of two separate commands.  Hence the
need to create copies of the data set each time.)

Is there a simpler way to do this using a DO REPEAT or LOOP command?

thanks,
Dennis

=====================
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: How to repeat a section of syntax

Bruce Weaver
Administrator
D.R. Wahlgren wrote
Gang,
I want to create a single line graph for each participant in my data
set.  The data are in long format, necessitated by the particular
GGRAPH commands I'm using.

My current approach is to create a temporary copy of the dataset
using DATASET COPY, use SELECT IF to reduce to a single ID#, then run
the graph, then close the dataset.   I've copied this set of syntax
as many times as I have participants in the data file, replacing the
ID# used in the SELECT IF command in each batch.

(Incidentally, I cannot use a TEMP command for the SELECT IF, because
the graph syntax is comprised of two separate commands.  Hence the
need to create copies of the data set each time.)

Is there a simpler way to do this using a DO REPEAT or LOOP command?

thanks,
Dennis
Try this (changing ID to the proper variable name if necessary):

sort cases by ID.
split file by ID.
* Your graph commands here .
split file off.

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