LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2004)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 22 Sep 2004 11:14:28 +0200
Reply-To:     lucameyer@tiscali.it
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Luca Meyer <lucameyer@tiscali.it>
Organization: Luca Meyer
Subject:      Mod(x,y) specification - why it does work this way?
In-Reply-To:  <41485B2D.6080804@verizon.net>
Content-Type: text/plain; charset="us-ascii"

Dear Art,

I am studying the following spss code you post on the list (this one is from a mail of Wednesday 15th):

> > new file. > input program. > string spec (A30). > loop #v = 1 to 5. > do if mod(#v,20) eq 1. > write outfile = 'd:\project\longway.sps' > / 'crosstabs' . > end if. > compute spec = concat(' /v1_', ltrim(string(#v,f3)),' by > v2_',ltrim(string(#v,f3))). write outfile = > 'd:\project\longway.sps' / spec . do if mod(#v,20) eq 0 or > #v eq 5. write outfile = 'd:\project\longway.sps' > / ' /cells = columns .' . > end if. > end loop. > end case. > end loop. > end file. > end input program. > execute. >

I am having hard time to understand how the MOD(#v,20) command you included in the syntax performs. As far as I understand from the SPSS v12 guide, the MOD(X,Y) command should return the reminded of the division of X by Y.

Now, if I write out the results you imply in the syntax they are:

#v=1 mod=1/20=05 #v=2 mod=2/20=1 #v=3 mod=3/20=15 #v=4 mod=4/20=2 #v=5 mod=4/20=25

So, from the

> do if mod(#v,20) eq 1. > write outfile = 'd:\project\longway.sps' > / 'crosstabs' . > end if.

I should actually expect that the outfile would be written starting from #v=2 and not from #v=1 - like it happens - or I am making a mistake somewhere?

Thanks for clarifying that point for me.

Luca

Mr. Luca Meyer Consumer research advisor: http://www.lucameyer.com/en/ Italian Online Research Mailing List: http://it.groups.yahoo.com/group/ior Tel: +390122854456 - Fax: +390122854837 - Mobile: + 393355217628

- One world, one human race -


Back to: Top of message | Previous page | Main SPSSX-L page