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 (February 2005)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 15 Feb 2005 15:19:52 +0100
Reply-To:   Max Bell <m.bell@bellherrmann.nl>
Sender:   "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:   Max Bell <m.bell@bellherrmann.nl>
Subject:   Re: Deleting a variable
Content-Type:   text/plain; charset="us-ascii"

Lars,

It's a lot of syntax but it works:

Let's say your variable is Var and it is numeric

First write a separate syntax C:\temp\Data.sps: DELETE VARIABLE Var.

And write a second separate syntax C:\temp\NoData.sps: * no commands .

Then the syntax you are looking for is (untested):

IF sysmis(Var)=1 s=1 . EXE. STRING incl (A100). IF s = 1 incl = "INCLUDE 'C:\temp\Nodata.sps'.". IF s ~= 1 incl = "INCLUDE 'C:\temp\Data.sps'.". EXE.

* a syntax file is created based on variable incl . SORT CASES BY s (A) . TEMPORARY . N 1 . WRITE OUTFILE= 'C:\Temp\DO.SPS' / incl . EXECUTE .

* the created syntax is run . INCLUDE 'C:\Temp\DO.SPS' .

And the syntax DO.sps either runs Nodata.sps or Data.sps.

Hope this helps.

Max

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of <Lars Johansson> Sent: dinsdag 15 februari 2005 14:22 To: SPSSX-L@LISTSERV.UGA.EDU Subject: Deleting a variable

I want to write a syntax that drops a variable if the variable contains no data (not on any row/case), is this possible?

Regards, Lars Johansson


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