Date: Wed, 5 Mar 2003 13:57:38 +0100
Reply-To: Cesar Ortega <cortega@unitec.edu>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Cesar Ortega <cortega@unitec.edu>
Subject: Thanks but I need to do some calculations in between(seleccion
case in a loop)
Content-Type: text/plain; charset=us-ascii
Hi there,
Sorry if it was not very clear, let me try to put it this way:
What I need to do is get the first 5 elements of a 5000 element column,
and do some calculations with this 5 elements. After this, I need to
take the next 5 elements and do the same calculations and son on until
I complete the list of the elements. And I need to do this for
different increments, not just 5, but 3, or 10, etc.
That is why I was thinking about using
use 1 thru 5
calculations
use 6 thru 10
calculations
All the way to the last elements, but without having to manually enter
the numbers, but doing some kind of loop.
If you have any other recommendation, it will be very helful.
Thanks for your help,
Cesar
Date: Tue, 4 Mar 2003 19:49:41 -0500
From: Raynald Levesque <rlevesque@videotron.ca>
Subject: Re: SELECTION CASE IN A LOOP
Hi
The question is not crystal clear but this should get you going:
*////////////.
DEFINE !use (beg=!TOKENS(1) /end=!TOKENS(1) /incr=!TOKENS(1))
!LET !delta=!SUBSTR(!BLANK(!incr),2)
!DO !cnt=!beg !TO !end !BY !incr
!LET !cnt2=!LENGTH(!CONCAT(!BLANK(!cnt),!delta))
USE !cnt THRU !cnt2.
!DOEND
!ENDDEFINE.
*////////////.
SET MPRINT=yes.
!use beg=1 end=50 incr=5.
* gives.
2681 M> USE 1 THRU 5.
2682 M> USE 6 THRU 10.
2683 M> USE 11 THRU 15.
2684 M> USE 16 THRU 20.
2685 M> USE 21 THRU 25.
2686 M> USE 26 THRU 30.
2687 M> USE 31 THRU 35.
2688 M> USE 36 THRU 40.
2689 M> USE 41 THRU 45.
2690 M> USE 46 THRU 50.
!use beg=7 end=48 incr=6.
* gives.
2707 M> USE 7 THRU 12.
2708 M> USE 13 THRU 18.
2709 M> USE 19 THRU 24.
2710 M> USE 25 THRU 30.
2711 M> USE 31 THRU 36.
2712 M> USE 37 THRU 42.
2713 M> USE 43 THRU 48.
Regards
Raynald Levesque rlevesque@videotron.ca
Visit my SPSS Pages http://pages.infinit.net/rlevesqu/index.htm