IBM Support

SUBSTR and other string functions not working

Troubleshooting


Problem

I have a numeric variable called 'old,' which I copied to a new column of data in my Data Editor. I then went to Variable View and changed the type from Numeric to String, then renamed this variable to 'temp.' Everything looks fine in the Data View screen. I then use the substring function in SPSS to compute a new variable, 'new,' based on the string variable, 'temp'. My syntax is shown below: STRING new (A4). COMPUTE new = SUBSTR(temp, 1). EXE. When I run the above commands, I get the error below: >Error # 4309 in column 256. Text: (End of Command) >Invalid combination of data types in an assignment. Character strings may >only be assigned to string variables. Numeric and logical quantities may >only be assigned to numeric variables. Consider using the STRING or NUMBER >function. >This command not executed. What is wrong?

[{"Product":{"code":"SSLVMB","label":"IBM SPSS Statistics"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":"Not Applicable","Platform":[{"code":"PF016","label":"Linux"},{"code":"PF014","label":"iOS"},{"code":"PF033","label":"Windows"}],"Version":"Not Applicable","Edition":"","Line of Business":{"code":"LOB76","label":"Data Platform"}}]

Log InLog in to view more of this document

This document has the abstract of a technical article that is available to authorized users once you have logged on. Please use Log in button above to access the full document. After log in, if you do not have the right authorization for this document, there will be instructions on what to do next.

Historical Number

20032

Document Information

Modified date:
16 April 2020

UID

swg21476729