Good Morning List Serv, I’m fairly new to SPSS, but wanted to know if there is any known way to change my data in the syntax from day month year 00:00:00 automatically to mm/dd/yyyy. I don’t want to do it manually every time.
Thanks Brent |
If the original date variables is stored as a DATE format variable then using ALTER TYPE command should allow you to convert the display of that variable to different date formats of your choice. I.e. if "OrigDate" is your original date variable then applying the below should get what you need: ALTER TYPE OrigDate (ADATE10). The "Type" column in "Variable View" of the "Data Editor" window will allow you to see the variables assignments of each variable, if you are unsure if the variable is stored as a DATE (or perhaps string). On 22 December 2014 at 13:13, Myers, Brent <[hidden email]> wrote:
|
I think this is just a format issue on top of a lack of understanding of how dates are represented in spss. Look at the syntax reference section on variables,
subsection on date/time variables and then look at the format section subsection date/time. Gene Maguin From: SPSSX(r) Discussion [mailto:[hidden email]]
On Behalf Of Jignesh Sutar If the original date variables is stored as a
DATE format variable then using ALTER TYPE command should allow you to convert the display of that variable to different date formats
of your choice. I.e. if "OrigDate" is your original date variable then applying the below should get what you need:
The "Type" column in "Variable View" of the "Data Editor" window will allow you to see the variables assignments of each variable, if you are unsure if the variable is stored as a DATE (or perhaps string). On 22 December 2014 at 13:13, Myers, Brent <[hidden email]> wrote:
===================== 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 Myers, Brent
what syntax to use depends on (a) whether the variables is in SPSS date format internally, (b) if you are reading it in from character data (e.g, ASCII) or (c) if it is an SPSS variable in string format.
If it is a date variable in SPSS, use FORMATS. IF is in character data, and is compatible with one of the kinds of character data SPSS can read, simply change the syntax by which you read the data. If the data is in an SPSS string variable, and is compatible with one of the kinds of character data SPSS can read use, ALTER TYPE. A more precise answer would require knowing how the data is currently stored. Also what variations are there in representation of the date if it is in string (character) form.
Art Kendall
Social Research Consultants |
Free forum by Nabble | Edit this page |