|
I'm trying to load a file that contains numerous date fields with a
yyyy-mm-dd format. ADATE and DATE don't seem to work in the GET DATA statement. Right now I'm reading them in as A10 (text) fields. Any way to pull this off in the GET DATA world, or do I need to resort to writing some COMPUTE code? Thanks, -Tim ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (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 |
|
Dear Tim,
I think this should work for a string (a10) date with yyyy-mm-dd: *Test data. data list free/date(a10). begin data 2010-07-29 1978-09-15 end data. *Actual code. alter type date(sdate10). formats date(adate10). Best, Ruben van den Berg Consultant Models & Methods TNS NIPO Email: [hidden email] Mobiel: +31 6 24641435 Telefoon: +31 20 522 5738 Internet: www.tns-nipo.com > Date: Thu, 29 Jul 2010 10:04:37 -0400 > From: [hidden email] > Subject: Dates with yyyy-mm-dd format > To: [hidden email] > > I'm trying to load a file that contains numerous date fields with a > yyyy-mm-dd format. ADATE and DATE don't seem to work in the GET DATA > statement. Right now I'm reading them in as A10 (text) fields. Any way to > pull this off in the GET DATA world, or do I need to resort to writing some > COMPUTE code? Thanks, > -Tim > > ===================== > To manage your subscription to SPSSX-L, send a message to > [hidden email] (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 |
|
In reply to this post by Tim Graettinger
You should be able to read these data with SDATE10 format. But if you read it as a string, you can use the Date/Time wizard on the Transform menu to generate conversion syntax. (It's different from what Ruben posted, but the result should be the same.) Jon Peck SPSS, an IBM Company [hidden email] 312-651-3435
I'm trying to load a file that contains numerous date fields with a yyyy-mm-dd format. ADATE and DATE don't seem to work in the GET DATA statement. Right now I'm reading them in as A10 (text) fields. Any way to pull this off in the GET DATA world, or do I need to resort to writing some COMPUTE code? Thanks, -Tim ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (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 |
| Free forum by Nabble | Edit this page |
