I inserted STRING ResidenceZipcodes (A5). in the code and the error message 
went away and this new variable did get all the digits beyond 5 truncated.
What confused me is that the original ResidenceZipcode showed on the variables 
table to be a string variable.  I assumed that the source variable, not the 
resulting variable is what had to be a string variable and that it would make 
the resulting variable automatically a string variable too.  I am a former SAS 
programmer, and that is how it was in SAS.

Thank you very much for the help.

________________________________
From: Pspp-users <pspp-users-bounces+ricardomejias=hotmail....@gnu.org> on 
behalf of pspp-users-requ...@gnu.org <pspp-users-requ...@gnu.org>
Sent: Thursday, March 4, 2021 4:07 PM
To: pspp-users@gnu.org <pspp-users@gnu.org>
Subject: Pspp-users Digest, Vol 177, Issue 2

Send Pspp-users mailing list submissions to
        pspp-users@gnu.org

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.gnu.org/mailman/listinfo/pspp-users
or, via email, send a message with subject or body 'help' to
        pspp-users-requ...@gnu.org

You can reach the person managing the list at
        pspp-users-ow...@gnu.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Pspp-users digest..."


Today's Topics:

   1. Re: Error Message on SUBSTRG String Function (Frans Houweling)


----------------------------------------------------------------------

Message: 1
Date: Thu, 4 Mar 2021 22:07:43 +0100
From: Frans Houweling <fhouwel...@email.it>
To: pspp-users@gnu.org
Subject: Re: Error Message on SUBSTRG String Function
Message-ID: <90adf4df-5ba0-15c9-be6f-92032b606...@email.it>
Content-Type: text/plain; charset="windows-1252"; Format="flowed"

Hi Ricardo,

  ResidenceZipcodes is a new variable here, and is therefore assumed to
be numeric.

Unless it was your intention re-assign to ResidenceZipCode, you need to
declare the variable as a string:

STRING ResidenceZipcodes (A5).

HTH

frans


On 3/4/21 9:43 PM, Ricardo Mejias wrote:
> Using a Substr string function on a string variable (see the screen
> shots below) I get an error message saying: "the expression has string
> type, but a numeric value is required here."Did I do something wrong
> or is this a bug?
>
>
>
>
>
>
>
>
>
> I am using GNU pspp 1.4.1-g79ad47 with Windows 10
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<https://lists.gnu.org/archive/html/pspp-users/attachments/20210304/cd625184/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 11501 bytes
Desc: not available
URL: 
<https://lists.gnu.org/archive/html/pspp-users/attachments/20210304/cd625184/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 23746 bytes
Desc: not available
URL: 
<https://lists.gnu.org/archive/html/pspp-users/attachments/20210304/cd625184/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 27511 bytes
Desc: not available
URL: 
<https://lists.gnu.org/archive/html/pspp-users/attachments/20210304/cd625184/attachment-0002.png>

------------------------------

Subject: Digest Footer

_______________________________________________
Pspp-users mailing list
Pspp-users@gnu.org
https://lists.gnu.org/mailman/listinfo/pspp-users


------------------------------

End of Pspp-users Digest, Vol 177, Issue 2
******************************************

Reply via email to