| Date: | Mon, 6 Jun 2005 14:09:39 +0200 |
| Reply-To: | Spousta Jan <JSpousta@CSAS.CZ> |
| Sender: | "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU> |
| From: | Spousta Jan <JSpousta@CSAS.CZ> |
| Subject: | Re: couple of questions about looping |
|
| Content-Type: | text/plain; charset="ISO-8859-1" |
Hi Siavoush,
For tasks like this one, it is usualy useful to use the !DO loop in SPSS macros. You will find useful informations about it in the SPSS manual (Help -> Command Syntax Refence, command Define-!Enddefine) and/or on R. Levesque's pages www.spsstools.net.
The basic structure of the macro will be like:
define nonlin ().
!do !a = 2 !to 22.
- COMPUTE ry = 1/(diss**(!a/10)) .
.... here the rest of the NLR stuff.
.... (rename the output file after !a)
.... (merge all output files)
!doend.
!enddefine.
....and you will call it by
nonlin.
Hope this helps
Jan
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of Dastmalchi
Sent: Monday, June 06, 2005 7:03 AM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: couple of questions about looping
Dear SPSS users,
I have sent this query once before, but I didn't get any reply. I was wondering if it is possible to do those things that I have mentioned below in SPSS. Your kind attention will be much appreciated.
***********************************
COMPUTE ry = 1/(diss**A) .
EXECUTE .
* NonLinear Regression.
MODEL PROGRAM K=0 B=0 N=1 .
COMPUTE PRED_ = K * (1 /(time) ** N) + B.
NLR ry
/OUTFILE='C:\DOCUME~1\DASTMA~1\LOCALS~1\Temp\spss1260\SPSSFNLR.TMP'
/PRED PRED_
/SAVE PRED
/CRITERIA SSCONVERGENCE 1E-8 PCON 1E-8 .
rename variables (pred_ = predry).
comput APD = 100*abs(predry-pawreduc)/pawreduc.
des/apd.
*************************************
My question is:
How can I declare a variable like A? I want to assign a value to the A
(i.g. 0.2), compute ry (see the syntax above) and then do my NLR. Then I
want to be able to do the same thing on a different set of data. At the
end I need to calculate a single mean APD for all data. (I just know this
much that I can give a code like 1, 2, ... to different data sets in the
data file and do the analysis by specifying the selection criteria (i.e.
/SELECT= var00001 EQ 1 ) but I am not sure this will work with NLR.
Finally, I need to write the mean APD and the corresponding A value to a
file and then change the value of A to A+incr and do the whole thing again
and write the result to the same file. Finally stop the procedure when A
is bigger than a value (i.g. 2.2).
I will appreciate if you could let me know the necessary commands to do
these analyses.
Best regards,
Siavoush
|