Transferring dates from Access to SPSS

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

Transferring dates from Access to SPSS

Jennifer Jones
Hello,



I am fairly new at this and am having some issues (big surprise eh?)



What I have is an access file with about 17,000 dates in it. The dates have
been entered in two different formats:



09/08/07

090807



They both transfer from Access to SPSS as string variables. The problem
occurs when I try to change them to date variables; the dates formatted
090807 now show up as missing data. Because there are so many of them I do
not want to go back and change these by hand. How can I change the
formatting to add the slashes?



Thank you,



Jennifer
Reply | Threaded
Open this post in threaded view
|

Re: Transferring dates from Access to SPSS

xiaoqin.wan@gmail.com
Hi,

try something like this:

* assume your datevar is var *.

IF (index(var, '/') = 0) var = concat(substr(var, 1, 2), '/', substr(var, 3,
2), '/', substr(var, 5, 2)).
HTH,

baiyun


2007/9/28, Jeni Jones <[hidden email]>:

>
> Hello,
>
>
>
> I am fairly new at this and am having some issues (big surprise eh?)
>
>
>
> What I have is an access file with about 17,000 dates in it. The dates
> have
> been entered in two different formats:
>
>
>
> 09/08/07
>
> 090807
>
>
>
> They both transfer from Access to SPSS as string variables. The problem
> occurs when I try to change them to date variables; the dates formatted
> 090807 now show up as missing data. Because there are so many of them I do
> not want to go back and change these by hand. How can I change the
> formatting to add the slashes?
>
>
>
> Thank you,
>
>
>
> Jennifer
>
Reply | Threaded
Open this post in threaded view
|

Re: Transferring dates from Access to SPSS

Norton, John
Hi All,

While the solution from Baiyun does answer the original question posted by Jennifer, I think it may be more efficient to simply use a DO IF procedure to convert the string to a recognizable date, rather than replace the "/" characters and then convert to dates.  The following code may help:

DO IF INDEX(date,'/') = 0.
COMPUTE new_date = DATE.MDY((NUMBER(SUBSTR(date,1,2),F2)),
 (NUMBER(SUBSTR(date,3,2),F2)),
 (NUMBER(SUBSTR(date,5,2),F2))).
ELSE.
COMPUTE new_date = DATE.MDY((NUMBER(SUBSTR(date,1,2),F2)),
 (NUMBER(SUBSTR(date,4,2),F2)),
 (NUMBER(SUBSTR(date,7,2),F2))).
END IF.
EXE.

FORMATS new_date (ADATE8).


HTH,

John Norton
SPSS Inc.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of [hidden email]
Sent: Friday, September 28, 2007 8:41 AM
To: [hidden email]
Subject: Re: Transferring dates from Access to SPSS

Hi,

try something like this:

* assume your datevar is var *.

IF (index(var, '/') = 0) var = concat(substr(var, 1, 2), '/', substr(var, 3,
2), '/', substr(var, 5, 2)).
HTH,

baiyun


2007/9/28, Jeni Jones <[hidden email]>:

>
> Hello,
>
>
>
> I am fairly new at this and am having some issues (big surprise eh?)
>
>
>
> What I have is an access file with about 17,000 dates in it. The dates
> have
> been entered in two different formats:
>
>
>
> 09/08/07
>
> 090807
>
>
>
> They both transfer from Access to SPSS as string variables. The problem
> occurs when I try to change them to date variables; the dates formatted
> 090807 now show up as missing data. Because there are so many of them I do
> not want to go back and change these by hand. How can I change the
> formatting to add the slashes?
>
>
>
> Thank you,
>
>
>
> Jennifer
>
Reply | Threaded
Open this post in threaded view
|

Re: Transferring dates from Access to SPSS

Florio Arguillas
Hi Jennifer,

There was a discussion here about converting a string to a date
variable a week or two ago, and someone suggested to check out the
Date and Time Wizard.  I found it to be a really cool tool.  Check it out.

Go to Transform>Date and Time Wizard, then select "Create a date/time
variable from a string containing a date or time", and follow the instructions.

Best regards,

Florio




At 10:58 AM 9/28/2007, Norton, John wrote:

>Hi All,
>
>While the solution from Baiyun does answer the original question
>posted by Jennifer, I think it may be more efficient to simply use a
>DO IF procedure to convert the string to a recognizable date, rather
>than replace the "/" characters and then convert to dates.  The
>following code may help:
>
>DO IF INDEX(date,'/') = 0.
>COMPUTE new_date = DATE.MDY((NUMBER(SUBSTR(date,1,2),F2)),
>  (NUMBER(SUBSTR(date,3,2),F2)),
>  (NUMBER(SUBSTR(date,5,2),F2))).
>ELSE.
>COMPUTE new_date = DATE.MDY((NUMBER(SUBSTR(date,1,2),F2)),
>  (NUMBER(SUBSTR(date,4,2),F2)),
>  (NUMBER(SUBSTR(date,7,2),F2))).
>END IF.
>EXE.
>
>FORMATS new_date (ADATE8).
>
>
>HTH,
>
>John Norton
>SPSS Inc.
>
>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On
>Behalf Of [hidden email]
>Sent: Friday, September 28, 2007 8:41 AM
>To: [hidden email]
>Subject: Re: Transferring dates from Access to SPSS
>
>Hi,
>
>try something like this:
>
>* assume your datevar is var *.
>
>IF (index(var, '/') = 0) var = concat(substr(var, 1, 2), '/', substr(var, 3,
>2), '/', substr(var, 5, 2)).
>HTH,
>
>baiyun
>
>
>2007/9/28, Jeni Jones <[hidden email]>:
> >
> > Hello,
> >
> >
> >
> > I am fairly new at this and am having some issues (big surprise eh?)
> >
> >
> >
> > What I have is an access file with about 17,000 dates in it. The dates
> > have
> > been entered in two different formats:
> >
> >
> >
> > 09/08/07
> >
> > 090807
> >
> >
> >
> > They both transfer from Access to SPSS as string variables. The problem
> > occurs when I try to change them to date variables; the dates formatted
> > 090807 now show up as missing data. Because there are so many of them I do
> > not want to go back and change these by hand. How can I change the
> > formatting to add the slashes?
> >
> >
> >
> > Thank you,
> >
> >
> >
> > Jennifer
> >
Reply | Threaded
Open this post in threaded view
|

logistic regression and interactions

Todd McDonald
I am using SPSS v 15 and have a question about interpreting interaction terms from a logistic regression model.  I have two variables i am interested in: gender and substance abuse (modeling the likelihood of arrest).  i listed some of the relevant output below - can some help?  i know how to read the coefficients but not the interaction term.  thanks in advance.

  variable                 B      Exp (B)

  female                   -.25   .600
  substance              .70    1.75
  female*substance   -1.24  .325


---------------------------------
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more.
Reply | Threaded
Open this post in threaded view
|

Re: Transferring dates from Access to SPSS

Victor Kogler
In reply to this post by Jennifer Jones
Jeni,

If all dates are in the same field in the Access table, and the field is
a text field.  You can do a find & replace in Access.  Open the table,
having created a backup copy first, highlight the field name at the top
of the column.  Then press Control+H, indicate you want to Find "/"
(omit quotes in the dialog) .  Leave the Replace field blank.  Indicate
that you want to Match "Any Part of Field".  Hit 'Replace All' and there
you go.

You will still have to convert the text values (e.g., 090807) to true
date fields in SPSS, but at least they will all be in the same format
when you import your Access table.



Victor Kogler




Jeni Jones wrote:

> Hello,
>
>
>
> I am fairly new at this and am having some issues (big surprise eh?)
>
>
>
> What I have is an access file with about 17,000 dates in it. The dates have
> been entered in two different formats:
>
>
>
> 09/08/07
>
> 090807
>
>
>
> They both transfer from Access to SPSS as string variables. The problem
> occurs when I try to change them to date variables; the dates formatted
> 090807 now show up as missing data. Because there are so many of them I do
> not want to go back and change these by hand. How can I change the
> formatting to add the slashes?
>
>
>
> Thank you,
>
>
>
> Jennifer
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: logistic regression and interactions

Fry, Jonathan B.
In reply to this post by Todd McDonald
I'm a little outside my bailiwick here, but a now-forgotten stats teacher gave me a point of view on this question that I don't remember seeing expressed in this group.

Significant interactions are hard to interpret because their significance means the model is, in a very limited sense, wrong.  It is often best to reformulate the model.  The resulting coefficients will be easier to interpret.

When one models anything in terms of two factors, A and B, the test
of their interaction is a test of whether the two factors on their own describe the response.  If it is significant, one concludes they do not.
All their combinations are required, and a single factor that enumerates those combinations will be easier to model with.

In this case, the single factor might be named gender_substance, and would have four values - female abuser, female non-abuser, male abuser, male non-abuser.  Female non-abuser might make a good reference category, as the other groups seem likely to have higher arrest rates.  That factor should have easy-to-interpret odds ratios.

We prefer simplicity, so we would all prefer to use female and substance in the model.  The significant interaction tells us that simplification is not justified.

Jonathan Fry
SPSS Inc.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Todd McDonald
Sent: Friday, September 28, 2007 11:36 AM
To: [hidden email]
Subject: logistic regression and interactions

I am using SPSS v 15 and have a question about interpreting interaction terms from a logistic regression model.  I have two variables i am interested in: gender and substance abuse (modeling the likelihood of arrest).  i listed some of the relevant output below - can some help?  i know how to read the coefficients but not the interaction term.  thanks in advance.

  variable                 B      Exp (B)

  female                   -.25   .600
  substance              .70    1.75
  female*substance   -1.24  .325


---------------------------------
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more.
Reply | Threaded
Open this post in threaded view
|

SPSS script to calculate Q-values

cbautista
In reply to this post by Victor Kogler
Hi,

Maybe someone in this list has a script to calculate q-values.

Thanks in advance,

/Christian
Reply | Threaded
Open this post in threaded view
|

Re: logistic regression and interactions

Gary Rosin
In reply to this post by Todd McDonald
> I am using SPSS v 15 and have a question about interpreting
> interaction terms from a logistic regression model.  I have two
> variables i am interested in: gender and substance abuse (modeling
> the likelihood of arrest).  i listed some of the relevant output
> below - can some help?  i know how to read the coefficients but
> not the interaction term.  thanks in advance.
>
>  variable                 B      Exp (B)
>
>  female                   -.25   .600
>  substance              .70    1.75
>  female*substance   -1.24  .325

Assuming that female is an indicator variable, your regression
has two forms, one for female = 0 & female = 1.

Female = 1
     the -0.25 changes the intercept
     the coefficient for substance is 0.70-1.24 = -0.54

Female = 0
     female and female*substance drop out of the equation (z*0 = 0),
     leaving the intercept the same
     the coefficient for substance is 0.70

Gary


   ---

Gary S. Rosin
Professor of Law
South Texas College of Law
1303 San Jacinto
Houston, TX  77002

<[hidden email]>
713-646-1854
Reply | Threaded
Open this post in threaded view
|

Re: logistic regression and interactions

Swank, Paul R
In reply to this post by Fry, Jonathan B.
I have to disagree here. Interactions are the spice of life. They merely
say that the effects are not additive. That doesn't make them
uninterpretable. In this case we doen't have all the results but what I
see is that those who do not abuse drugs are less likely to be arrested,
females are less likely to be arrested, but if you are a female who does
not abuse drugs you are much less likely to be arrested than you would
think based on the parameters for female and abuse. The world is a
complicated palce. People like simplicity but surely not to the extent
that we would make the model wrong? This says an additive model is wrong
so we have a multiplicative model.Figure the odds ratios for the males
and females from the model. The difference in the odds of arrest for
males who do and do not abuse drugs is much smaller than for females. It
looks as if the odds of being arrest for males who abuse drugs is 2
times for those who do not but the odds for females who do is only .58
compared to those who don't. Very interesting. Why would that be?

Paul R. Swank, Ph.D. Professor
Director of Reseach
Children's Learning Institute
University of Texas Health Science Center-Houston


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Fry, Jonathan B.
Sent: Friday, September 28, 2007 12:16 PM
To: [hidden email]
Subject: Re: logistic regression and interactions

I'm a little outside my bailiwick here, but a now-forgotten stats
teacher gave me a point of view on this question that I don't remember
seeing expressed in this group.

Significant interactions are hard to interpret because their
significance means the model is, in a very limited sense, wrong.  It is
often best to reformulate the model.  The resulting coefficients will be
easier to interpret.

When one models anything in terms of two factors, A and B, the test of
their interaction is a test of whether the two factors on their own
describe the response.  If it is significant, one concludes they do not.
All their combinations are required, and a single factor that enumerates
those combinations will be easier to model with.

In this case, the single factor might be named gender_substance, and
would have four values - female abuser, female non-abuser, male abuser,
male non-abuser.  Female non-abuser might make a good reference
category, as the other groups seem likely to have higher arrest rates.
That factor should have easy-to-interpret odds ratios.

We prefer simplicity, so we would all prefer to use female and substance
in the model.  The significant interaction tells us that simplification
is not justified.

Jonathan Fry
SPSS Inc.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Todd McDonald
Sent: Friday, September 28, 2007 11:36 AM
To: [hidden email]
Subject: logistic regression and interactions

I am using SPSS v 15 and have a question about interpreting interaction
terms from a logistic regression model.  I have two variables i am
interested in: gender and substance abuse (modeling the likelihood of
arrest).  i listed some of the relevant output below - can some help?  i
know how to read the coefficients but not the interaction term.  thanks
in advance.

  variable                 B      Exp (B)

  female                   -.25   .600
  substance              .70    1.75
  female*substance   -1.24  .325


---------------------------------
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket:
mail, news, photos & more.
Reply | Threaded
Open this post in threaded view
|

Re: logistic regression and interactions

John M. Trent
Paul,

As a 'systems thinker' in the S. Minuchin framework, I am reminded he was wont to say, "it's more complicated than that" and I think your interpretation of the interactions are 'right on,' however, the context must guide all interpretation...and of course the non additive component makes the interactions abit more abstract...

However, could it be this: we all know about double standards in life...I wonder if this is simply an artifact of that double standard (males are expected to but females are not expected to)...context often helps me in interpreting such conundrums...

John Mark



John Mark Trent, PhD
Educational Psychologist
Family Therapist

Change occurs only as we begin thinking about and working on the self ---
rather than staying focused on and reactive to the other
http://relationalgrace.blogspot.com/



________________________________

From: SPSSX(r) Discussion on behalf of Swank, Paul R
Sent: Fri 9/28/2007 3:40 PM
To: [hidden email]
Subject: Re: logistic regression and interactions



I have to disagree here. Interactions are the spice of life. They merely
say that the effects are not additive. That doesn't make them
uninterpretable. In this case we doen't have all the results but what I
see is that those who do not abuse drugs are less likely to be arrested,
females are less likely to be arrested, but if you are a female who does
not abuse drugs you are much less likely to be arrested than you would
think based on the parameters for female and abuse. The world is a
complicated palce. People like simplicity but surely not to the extent
that we would make the model wrong? This says an additive model is wrong
so we have a multiplicative model.Figure the odds ratios for the males
and females from the model. The difference in the odds of arrest for
males who do and do not abuse drugs is much smaller than for females. It
looks as if the odds of being arrest for males who abuse drugs is 2
times for those who do not but the odds for females who do is only .58
compared to those who don't. Very interesting. Why would that be?

Paul R. Swank, Ph.D. Professor
Director of Reseach
Children's Learning Institute
University of Texas Health Science Center-Houston


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Fry, Jonathan B.
Sent: Friday, September 28, 2007 12:16 PM
To: [hidden email]
Subject: Re: logistic regression and interactions

I'm a little outside my bailiwick here, but a now-forgotten stats
teacher gave me a point of view on this question that I don't remember
seeing expressed in this group.

Significant interactions are hard to interpret because their
significance means the model is, in a very limited sense, wrong.  It is
often best to reformulate the model.  The resulting coefficients will be
easier to interpret.

When one models anything in terms of two factors, A and B, the test of
their interaction is a test of whether the two factors on their own
describe the response.  If it is significant, one concludes they do not.
All their combinations are required, and a single factor that enumerates
those combinations will be easier to model with.

In this case, the single factor might be named gender_substance, and
would have four values - female abuser, female non-abuser, male abuser,
male non-abuser.  Female non-abuser might make a good reference
category, as the other groups seem likely to have higher arrest rates.
That factor should have easy-to-interpret odds ratios.

We prefer simplicity, so we would all prefer to use female and substance
in the model.  The significant interaction tells us that simplification
is not justified.

Jonathan Fry
SPSS Inc.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Todd McDonald
Sent: Friday, September 28, 2007 11:36 AM
To: [hidden email]
Subject: logistic regression and interactions

I am using SPSS v 15 and have a question about interpreting interaction
terms from a logistic regression model.  I have two variables i am
interested in: gender and substance abuse (modeling the likelihood of
arrest).  i listed some of the relevant output below - can some help?  i
know how to read the coefficients but not the interaction term.  thanks
in advance.

  variable                 B      Exp (B)

  female                   -.25   .600
  substance              .70    1.75
  female*substance   -1.24  .325


---------------------------------
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket:
mail, news, photos & more.