pspp-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pspp-users Digest, Vol 177, Issue 2


From: Ben Pfaff
Subject: Re: Pspp-users Digest, Vol 177, Issue 2
Date: Sun, 7 Mar 2021 11:34:22 -0800

I pushed an improvement to the error message. Now it should say
something like this:

parse.sps:2: error: COMPUTE: This command tries to create a new
variable myvar by assigning a string value to it, but this is not
supported.  Use the STRING command to create the new variable with the
correct width before assigning to it, e.g. STRING myvar(A20).

On Thu, Mar 4, 2021 at 4:32 PM Ben Pfaff <blp@cs.stanford.edu> wrote:
>
> It would be easy enough for PSPP to see that the expression has string type, 
> and therefore give the new variable string type too. The reason it doesn't 
> work that way is that it's not always possible to know the maximum width of 
> an expression that has string type, but SPSS and PSPP require string 
> variables to have a fixed width.
>
> It's a poor error message. I'll make a note to improve it.
>
> On Thu, Mar 4, 2021 at 1:49 PM Ricardo Mejias <ricardomejias@hotmail.com> 
> wrote:
>>
>> 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.com@gnu.org> on 
>> behalf of pspp-users-request@gnu.org <pspp-users-request@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-request@gnu.org
>>
>> You can reach the person managing the list at
>>         pspp-users-owner@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 <fhouweling@email.it>
>> To: pspp-users@gnu.org
>> Subject: Re: Error Message on SUBSTRG String Function
>> Message-ID: <90adf4df-5ba0-15c9-be6f-92032b606e68@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

[Prev in Thread] Current Thread [Next in Thread]