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 (July 2006)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 18 Jul 2006 14:14:38 -0400
Reply-To:     Richard Ristow <>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Richard Ristow <>
Subject:      Re: comparing string to numeric
Comments: To: Samuel Solomon <>
Comments: cc: Hector Maletta <hmaletta@FIBERTEL.COM.AR>
In-Reply-To:  < >
Content-Type: text/plain; charset=us-ascii; format=flowed;

To expand a little on what Hector Maletta wrote, which is correct:

At 11:28 AM 7/18/2006, Samuel Solomon wrote:

>I would like you to help me on how I could compare a string to numeric >and vice versa.

The broad question is, what does it mean for your string and your numeric quantities to be the same?

Hector wrote for what's probably the case: your string variable contains the character representation of a numeric quantity, and 'the same' means that they represent the same numeric quantity. Unless you have more specifications, it's the only possible case, because a numeric quantity does not have a canonical string representation. That is, a numeric quantity can be converted to a string with the STRING function; but if the quantity is 3, then '3', '003', and '3.00' are all possible string conversions, none more representative of the quantity 3 than are any of the others.

So, if you have anything else in mind, you should probably write again.

One caveat: if your string does NOT represent a valid numeric quantity, then the value of Hectors "newvar" will be system-missing. If you compare it to your numeric quantity, the comparison will return 'missing', not 'false', and the difference matters in some cases.

So, don't test "stringvar EQ newvar"; test

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