CHANGE BIRTH DATE IN SYNTAX AUTOMATICALLY

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

CHANGE BIRTH DATE IN SYNTAX AUTOMATICALLY

Myers, Brent

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

 

 

===================== 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
Reply | Threaded
Open this post in threaded view
|

Re: CHANGE BIRTH DATE IN SYNTAX AUTOMATICALLY

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:

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:

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

 

 

===================== 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

===================== 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
Reply | Threaded
Open this post in threaded view
|

Re: CHANGE BIRTH DATE IN SYNTAX AUTOMATICALLY

Maguin, Eugene

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
Sent: Monday, December 22, 2014 8:27 AM
To: [hidden email]
Subject: Re: CHANGE BIRTH DATE IN SYNTAX AUTOMATICALLY

 

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:

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

 

 

===================== 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

 

===================== 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

===================== 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
Reply | Threaded
Open this post in threaded view
|

Re: CHANGE BIRTH DATE IN SYNTAX AUTOMATICALLY

Art Kendall
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