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 (October 2003)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 30 Oct 2003 10:24:34 -0600
Reply-To:     "Marks, Jim" <Jim.Marks@lodgenet.com>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         "Marks, Jim" <Jim.Marks@lodgenet.com>
Subject:      Re: zero values dropped
Content-Type: text/plain; charset="US-ASCII"

Michael:

I duplicated your file and ran your syntax, but I couldn't recreate your result:

DATA LIST FREE /sweptime length amp code. BEGIN DATA 72.00 2.00 1.00 1 74.00 2.00 1.00 1 82.00 2.00 1.00 1 2.00 2.00 1.00 65 4.00 2.00 1.00 65 8.00 2.00 1.00 65 32.67 2.00 1.00 65 38.00 2.00 1.00 65 40.00 2.00 1.00 65 46.00 2.00 1.00 65 54.67 2.00 1.00 65 58.67 2.00 1.00 65 72.00 2.00 1.00 65 74.00 2.00 1.00 65 82.00 2.00 1.00 65 .00 2.00 1.00 66 .67 2.00 1.00 66 1.33 2.00 1.00 66 2.67 2.00 1.00 66 END DATA.

COMPUTE filter_$=(code = 66). VARIABLE LABEL filter_$ 'code = 66 (FILTER)'. VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'. FORMAT filter_$ (f1.0). FILTER BY filter_$. EXECUTE . SAVE TRANSLATE OUTFILE='C:\spss-test\code66.dat' /TYPE=TAB /MAP /REPLACE /DROP=code filter_$ .

The file "C:\spss-test\code66.dat" contained the first 3 columns for all 19 cases, including the zero value case for code = 66. I checked in Notepad and TextPad (two text file editors) as well as SPSS.

Could the problem be in the program you are using to open the .dat file? Your example shows the first case as "2 2 1" which is the first case for code = 65, not the first case in your sample.

BTW are you trying to create a file only with the code = 66 cases? If so, you need the subcommand "/UNSELECTED= DELETE" in the SAVE TRANSLATE statement. Alternatively, if this syntax is part of a macro/ loop/ do if structure, perhaps there are unexpected filters created in the structure?

A simple macro works to make 3 .dat files:

** macro for 3 files. DEFINE !mltfil (varn =!CMDEND).

!DO !var !IN (!varn) COMPUTE filter_$=(code = !var). VARIABLE LABEL filter_$ 'code = !var (FILTER)'. VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'. FORMAT filter_$ (f1.0). FILTER BY filter_$. EXECUTE . SAVE TRANSLATE OUTFILE=!QUOTE(!CONCAT( "C:\spss-test\code",!var,".dat")) /TYPE=TAB /MAP /REPLACE /UNSELECTED = DELETE /DROP=code filter_$ . !DOEND !ENDDEFINE

* run macro. !mltfil varn = 1 65 66.

It seems that your syntax as posted is working. The problem could be in the next layer of syntax, and we might need yet more detail.

Cheers

Jim Marks Senior Market Analyst LodgeNet Entertainment Corporation

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of Michael Bersick Sent: Thursday, October 30, 2003 9:24 AM To: SPSSX-L@LISTSERV.UGA.EDU Subject: Re: zero values dropped

My apologies for not including syntax. I am using 11.5. Still puzzled, Mike

Here is some original data:

sweptime length amp code

72.00 2.00 1.00 1 74.00 2.00 1.00 1 82.00 2.00 1.00 1 2.00 2.00 1.00 65 4.00 2.00 1.00 65 8.00 2.00 1.00 65 32.67 2.00 1.00 65 38.00 2.00 1.00 65 40.00 2.00 1.00 65 46.00 2.00 1.00 65 54.67 2.00 1.00 65 58.67 2.00 1.00 65 72.00 2.00 1.00 65 74.00 2.00 1.00 65 82.00 2.00 1.00 65 .00 2.00 1.00 66 .67 2.00 1.00 66 1.33 2.00 1.00 66 2.67 2.00 1.00 66

Here is some syntax (pasted) which drops the 1st (zero valued) case for code=66:

GET FILE='E:\WPDOCS\Program Project\OwlERPs\OWL_fMRI\Owl_003\OwlA_001.SAV'. USE ALL. COMPUTE filter_$=(code = 66). VARIABLE LABEL filter_$ 'code = 66 (FILTER)'. VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'. FORMAT filter_$ (f1.0). FILTER BY filter_$. EXECUTE . SAVE TRANSLATE OUTFILE='E:\WPDOCS\Program'+ ' Project\OwlERPs\OWL_fMRI\Owl_003\OwlA_001.dat' /TYPE=TAB /MAP /REPLACE /DROP=code filter_$ .

Here is the beginning of the text file which results, missing said case:

2 2 1 4 2 1 8 2 1 32.6666666666667 2 1 38 2 1 40 2 1 46 2 1

>From: Simon Freidin <s.freidin@iaesr.unimelb.edu.au> >To: Michael Bersick <mbersick@hotmail.com> >Subject: Re: zero values dropped >Date: Thu, 30 Oct 2003 09:18:40 +1100 > >You haven't provided enough information - why didn't you post your syntax? >select if or do if ? >perhaps you need >= 0 not >0? > >hth >Simon > >At 12:53 PM 10/29/2003 -0700, you wrote: >>Hi, >>I'm working on a macro in part of which I save a SAV file to a DAT file >>individually for each value of a given variable. The data are simple: >> >>.00 2 1 >>2.6 2 1 >>6.3 2 1 >> >>However, when saving as a text file I get: >> >>2.6 2 1 >>6.3 2 1 >> >>Why does the case with a zero value on the first variable get dropped? No >>missing values are specified, and, in any event, I am unaware of any >>"listwise deletion" of cases while saving data. Any insight would be >>sorely >>appreciated, since I don't want to add .1 to the zeros or manually enter >>in >>the missing cases across a large # of files. Maybe I'm blind to the answer >>in front of me. >> >>Gratefully, >>Mike Bersick >> >>_________________________________________________________________ >>Enjoy MSN 8 patented spam control and more with MSN 8 Dial-up Internet >>Service. Try it FREE for one month! >>http://join.msn.com/?page=dept/dialup > > >Research Database Manager and Analyst >Melbourne Institute of Applied Economic and Social Research >The University of Melbourne >Melbourne VIC 3010 Australia >Tel: (03) 8344 3601 Fax: (03) 8344 5630 >http://www.melbourneinstitute.com/hilda/ >

_________________________________________________________________ Want to check if your PC is virus-infected? Get a FREE computer virus scan online from McAfee. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


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