Date: Thu, 1 Dec 2011 09:10:07 -0800
Reply-To: David Marso <david.marso@gmail.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: David Marso <david.marso@gmail.com>
Subject: Re: SPSS cannot treat string variables as string variables?
In-Reply-To: <CACdH1Vgzv5uCDh-z=kHw+Y6oU2wRJ49JEZYOs3=Cqb7d6Mju4Q@mail.gmail.com>
Content-Type: text/plain; charset=us-ascii
One must *DECLARE* string variables prior to use in transformation
expressions!
STRING timedate (A11).
huang jialin wrote
>
> Hi,
>
> I imported data from SQL sever by ODBC. There is a string variable,
> formatted as following:
>
> Jun 22 2010 6:23AM
> Apr 11 2011 3:16PM
> Nov 1 2010 10:52PM
> Aug 11 2011 12:05PM
>
> I tried to pull out the date only, by using substr() function in SPSS.
> Thus, my syntax is as below:
>
> COMPUTE timedate=substr(var00001, 1, 11).
> EXECUTE.
>
> But I kept on having warning like this:
>
>>Error # 4309 in column 1024. 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.
>>Execution of this command stops.
>
> However, in the variable view, it is a string variable. How can I solve
> this problem?
>
> Thank you very much.
>
> Sincerely,
> Jialin
>
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/SPSS-cannot-treat-string-variables-as-string-variables-tp5039329p5039341.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
|