|Date: ||Fri, 28 Aug 1998 11:35:40 -0700|
|Reply-To: ||Dale Glaser <dale.glaser@SHARP.COM>|
|Sender: ||"SPSSX(r) Discussion" <SPSSX-L@UGA.CC.UGA.EDU>|
|From: ||Dale Glaser <dale.glaser@SHARP.COM>|
|Subject: ||string variables and substr function|
|Content-Type: ||text/plain; charset=US-ASCII|
Hi there...I have attempted to follow some very helpful advice in converting a numeric date into the objective of an ADATE8 format:
of which I did find out that the leading zeros were truncated (data was entered in dBase3)......so in attempting to create a year variable I employed the following strategy:
...I converted the numeric date into a A6 length string variable (date), then used the following syntax:
compute day =substr(date,3,2).
I get the following error message:
>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
>This command not executed.
For some reason, the variable "date", which was indeed converted into a string variable, is not being recognized as such.....I have tried multiple strategies, including keeping the variable numeric and attempting to segment it into month, day, and year accordingly, but it seems that with SPSS you have to start with a string variable in order to do that....I thought possibly the problem was the lack of leading zeros, so I attempted using options such as:
but same error message.......hmmmmmm any suggestions........?
take care and thank you!!!