syntax for graphics

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

syntax for graphics

Monika Heinzel-Gutenbrunner-2
Dear all,



I wonder if GPL offers any possibility of changing the size of lettering
and the gauge of lines (e.g. axes) by means of syntax. We have a number
of graphs that have to be plotted time and again with other data. If the
formatting of axes, lines, lettering and graphs has to be entered
manually by means of the GRAPH EDITOR, it is very time-consuming. Using
templates is of no real help, either.



I would very much appreciate your help. Thank you.



Best regards,



Monika Heinzel-Gutenbrunner
Reply | Threaded
Open this post in threaded view
|

Re: syntax for graphics

ViAnn Beadle
No. You need to develop a template by editing one of your charts, save it,
and then specify that template via syntax. Why do you say that templates are
of no help here?

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Monika Heinzel-Gutenbrunner
Sent: Wednesday, September 05, 2007 1:45 AM
To: [hidden email]
Subject: syntax for graphics

Dear all,



I wonder if GPL offers any possibility of changing the size of lettering
and the gauge of lines (e.g. axes) by means of syntax. We have a number
of graphs that have to be plotted time and again with other data. If the
formatting of axes, lines, lettering and graphs has to be entered
manually by means of the GRAPH EDITOR, it is very time-consuming. Using
templates is of no real help, either.



I would very much appreciate your help. Thank you.



Best regards,



Monika Heinzel-Gutenbrunner
Reply | Threaded
Open this post in threaded view
|

Question on dealing with dates in variables

stace swayne
Dear list,

  I have a series of variables that are dates, but they are broken down by var1month, var1year, var2month, var2year,.

  What I would like to do is combine the month and year variables into one variable.

  Can anyone give me advice on the syntax needed to accomplish this?

  all suggestions are appreciated,

  thanks

  Stace


---------------------------------
Be a better Heartthrob. Get better relationship answers from someone who knows.
Yahoo! Answers - Check it out.
Reply | Threaded
Open this post in threaded view
|

Re: Question on dealing with dates in variables

Florio Arguillas
Hi Stace,

Here's one option using the DATE.MOYR function.   Submit this sample code.

compute month1 = 12.
compute month2 = 1.
compute year1 = 1998.
compute year2 = 1999.
execute.

COMPUTE month1year1 = DATE.MOYR(month1,year1) .
FORMAT month1year1 (moyr).
EXECUTE .

Best regards,

Florio



At 11:09 AM 9/5/2007, stace swayne wrote:

>Dear list,
>
>   I have a series of variables that are dates, but they are broken
> down by var1month, var1year, var2month, var2year,.
>
>   What I would like to do is combine the month and year variables
> into one variable.
>
>   Can anyone give me advice on the syntax needed to accomplish this?
>
>   all suggestions are appreciated,
>
>   thanks
>
>   Stace
>
>
>---------------------------------
>Be a better Heartthrob. Get better relationship answers from someone
>who knows.
>Yahoo! Answers - Check it out.
Reply | Threaded
Open this post in threaded view
|

Re: Question on dealing with dates in variables

Florio Arguillas
In reply to this post by stace swayne
Here's another option which concatenates the month and year variable.

compute month1 = 12.
compute month2 = 1.
compute year1 = 1998.
compute year2 = 1999.
execute.

COMPUTE month1year1a = month1*10000 + year1.
COMPUTE month2year2a = month2*10000 + year2.
EXECUTE .



At 11:09 AM 9/5/2007, stace swayne wrote:

>Dear list,
>
>   I have a series of variables that are dates, but they are broken
> down by var1month, var1year, var2month, var2year,.
>
>   What I would like to do is combine the month and year variables
> into one variable.
>
>   Can anyone give me advice on the syntax needed to accomplish this?
>
>   all suggestions are appreciated,
>
>   thanks
>
>   Stace
>
>
>---------------------------------
>Be a better Heartthrob. Get better relationship answers from someone
>who knows.
>Yahoo! Answers - Check it out.
Reply | Threaded
Open this post in threaded view
|

Re: Question on dealing with dates in variables

Richard Ristow
In reply to this post by Florio Arguillas
At 11:09 AM 9/5/2007, stace swayne had written:

>I have a series of variables that are dates, but they are broken down
>by var1month, var1year, var2month, var2year,. I would like to combine
>the month and year variables into one variable.

At 12:10 PM 9/5/2007, Florio Arguillas wrote:

>Here's one option using the DATE.MOYR function.   Submit this sample
>code.
>
>compute month1 = 12.
>compute month2 = 1.
>compute year1 = 1998.
>compute year2 = 1999.
>execute.
>
>COMPUTE month1year1 = DATE.MOYR(month1,year1) .
>FORMAT month1year1 (moyr).
>EXECUTE .

Of the two suggestions, I think this is considerably the preferable.
Date values in SPSS files should almost always be SPSS-format dates, as
this does.

And, since I haven't said it recently: the EXECUTE statements are not
necessary, do nothing useful, and may slow processing considerably in a
large file.

-Good luck and good wishes,
  Richard
Reply | Threaded
Open this post in threaded view
|

Re: Question on dealing with dates in variables

Ornelas, Fermin
I am going to tag along this answer/question.
In my mainframe version I have two dates formatted as yyyymmdd and
yyyymm.
(20070605 200706). What I would like is to output these as:

06/05/07 and 06/01/07


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Richard Ristow
Sent: Wednesday, September 05, 2007 10:02 AM
To: [hidden email]
Subject: Re: Question on dealing with dates in variables

At 11:09 AM 9/5/2007, stace swayne had written:

>I have a series of variables that are dates, but they are broken down
>by var1month, var1year, var2month, var2year,. I would like to combine
>the month and year variables into one variable.

At 12:10 PM 9/5/2007, Florio Arguillas wrote:

>Here's one option using the DATE.MOYR function.   Submit this sample
>code.
>
>compute month1 = 12.
>compute month2 = 1.
>compute year1 = 1998.
>compute year2 = 1999.
>execute.
>
>COMPUTE month1year1 = DATE.MOYR(month1,year1) .
>FORMAT month1year1 (moyr).
>EXECUTE .

Of the two suggestions, I think this is considerably the preferable.
Date values in SPSS files should almost always be SPSS-format dates, as
this does.

And, since I haven't said it recently: the EXECUTE statements are not
necessary, do nothing useful, and may slow processing considerably in a
large file.

-Good luck and good wishes,
  Richard

NOTICE: This e-mail (and any attachments) may contain PRIVILEGED OR
CONFIDENTIAL information and is intended only for the use of the
specific individual(s) to whom it is addressed.  It may contain
information that is privileged and confidential under state and federal
law.  This information may be used or disclosed only in accordance with
law, and you may be subject to penalties under law for improper use or
further disclosure of the information in this e-mail and its
attachments. If you have received this e-mail in error, please
immediately notify the person named above by reply e-mail, and then
delete the original e-mail.  Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: Question on dealing with dates in variables

Florio Arguillas
In reply to this post by Richard Ristow
I agree with your regarding the EXECUTE command Richard.  It's just
too annoying to see that "transformation pending" status at the
status bar.  You either have to submit an EXECUTE command, run a
procedure or save the dataset to get rid of it.



At 01:02 PM 9/5/2007, Richard Ristow wrote:

>At 11:09 AM 9/5/2007, stace swayne had written:
>
>>I have a series of variables that are dates, but they are broken
>>down by var1month, var1year, var2month, var2year,. I would like to
>>combine the month and year variables into one variable.
>
>At 12:10 PM 9/5/2007, Florio Arguillas wrote:
>
>>Here's one option using the DATE.MOYR function.   Submit this sample code.
>>
>>compute month1 = 12.
>>compute month2 = 1.
>>compute year1 = 1998.
>>compute year2 = 1999.
>>execute.
>>
>>COMPUTE month1year1 = DATE.MOYR(month1,year1) .
>>FORMAT month1year1 (moyr).
>>EXECUTE .
>
>Of the two suggestions, I think this is considerably the preferable.
>Date values in SPSS files should almost always be SPSS-format dates,
>as this does.
>
>And, since I haven't said it recently: the EXECUTE statements are
>not necessary, do nothing useful, and may slow processing
>considerably in a large file.
>
>-Good luck and good wishes,
>  Richard
Reply | Threaded
Open this post in threaded view
|

Re: Question on dealing with dates in variables

ViAnn Beadle
That seems to be a minor reason for forcing unnecessary passes of data--if
the message bothers you so much you can turn off the status bar.

And I am in total agreement with Richard on the issue of maintaining a date
as a date variable, especially if you ever want to do arithmetic on dates

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Florio Arguillas
Sent: Wednesday, September 05, 2007 11:29 AM
To: [hidden email]
Subject: Re: Question on dealing with dates in variables

I agree with your regarding the EXECUTE command Richard.  It's just
too annoying to see that "transformation pending" status at the
status bar.  You either have to submit an EXECUTE command, run a
procedure or save the dataset to get rid of it.



At 01:02 PM 9/5/2007, Richard Ristow wrote:

>At 11:09 AM 9/5/2007, stace swayne had written:
>
>>I have a series of variables that are dates, but they are broken
>>down by var1month, var1year, var2month, var2year,. I would like to
>>combine the month and year variables into one variable.
>
>At 12:10 PM 9/5/2007, Florio Arguillas wrote:
>
>>Here's one option using the DATE.MOYR function.   Submit this sample code.
>>
>>compute month1 = 12.
>>compute month2 = 1.
>>compute year1 = 1998.
>>compute year2 = 1999.
>>execute.
>>
>>COMPUTE month1year1 = DATE.MOYR(month1,year1) .
>>FORMAT month1year1 (moyr).
>>EXECUTE .
>
>Of the two suggestions, I think this is considerably the preferable.
>Date values in SPSS files should almost always be SPSS-format dates,
>as this does.
>
>And, since I haven't said it recently: the EXECUTE statements are
>not necessary, do nothing useful, and may slow processing
>considerably in a large file.
>
>-Good luck and good wishes,
>  Richard
Reply | Threaded
Open this post in threaded view
|

Re: Question on dealing with dates in variables

Florio Arguillas
Actually another reason is that if you do not run an execute command,
a procedure, or save the data set, you can't see the values of the
new variable you created in the Data Editor window.

If you have another way of immediately displaying the values of the
newly created variables in the Data Editor after submitting a COMPUTE
command without doing any of those three above, please tell me.  I
want to learn.

Bad idea to turn off the status bar.  Never do it no matter how
annoying.  What if you have a WEIGHT ON or FILTER on?






At 01:40 PM 9/5/2007, ViAnn Beadle wrote:

>That seems to be a minor reason for forcing unnecessary passes of data--if
>the message bothers you so much you can turn off the status bar.
>
>And I am in total agreement with Richard on the issue of maintaining a date
>as a date variable, especially if you ever want to do arithmetic on dates
>
>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
>Florio Arguillas
>Sent: Wednesday, September 05, 2007 11:29 AM
>To: [hidden email]
>Subject: Re: Question on dealing with dates in variables
>
>I agree with your regarding the EXECUTE command Richard.  It's just
>too annoying to see that "transformation pending" status at the
>status bar.  You either have to submit an EXECUTE command, run a
>procedure or save the dataset to get rid of it.
>
>
>
>At 01:02 PM 9/5/2007, Richard Ristow wrote:
> >At 11:09 AM 9/5/2007, stace swayne had written:
> >
> >>I have a series of variables that are dates, but they are broken
> >>down by var1month, var1year, var2month, var2year,. I would like to
> >>combine the month and year variables into one variable.
> >
> >At 12:10 PM 9/5/2007, Florio Arguillas wrote:
> >
> >>Here's one option using the DATE.MOYR function.   Submit this sample code.
> >>
> >>compute month1 = 12.
> >>compute month2 = 1.
> >>compute year1 = 1998.
> >>compute year2 = 1999.
> >>execute.
> >>
> >>COMPUTE month1year1 = DATE.MOYR(month1,year1) .
> >>FORMAT month1year1 (moyr).
> >>EXECUTE .
> >
> >Of the two suggestions, I think this is considerably the preferable.
> >Date values in SPSS files should almost always be SPSS-format dates,
> >as this does.
> >
> >And, since I haven't said it recently: the EXECUTE statements are
> >not necessary, do nothing useful, and may slow processing
> >considerably in a large file.
> >
> >-Good luck and good wishes,
> >  Richard
Reply | Threaded
Open this post in threaded view
|

Re: Question on dealing with dates in variables

Noble, Lyndsay
In reply to this post by stace swayne
So use one "EXECUTE" at the end of all of the code.  The slowness comes from
having multiple "EXECUTE" statements.

Lyndsay

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Florio Arguillas
Sent: Wednesday, September 05, 2007 10:54 AM
To: [hidden email]
Subject: Re: Question on dealing with dates in variables

Actually another reason is that if you do not run an execute command,
a procedure, or save the data set, you can't see the values of the
new variable you created in the Data Editor window.

If you have another way of immediately displaying the values of the
newly created variables in the Data Editor after submitting a COMPUTE
command without doing any of those three above, please tell me.  I
want to learn.

Bad idea to turn off the status bar.  Never do it no matter how
annoying.  What if you have a WEIGHT ON or FILTER on?






At 01:40 PM 9/5/2007, ViAnn Beadle wrote:

>That seems to be a minor reason for forcing unnecessary passes of data--if
>the message bothers you so much you can turn off the status bar.
>
>And I am in total agreement with Richard on the issue of maintaining a date
>as a date variable, especially if you ever want to do arithmetic on dates
>
>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
>Florio Arguillas
>Sent: Wednesday, September 05, 2007 11:29 AM
>To: [hidden email]
>Subject: Re: Question on dealing with dates in variables
>
>I agree with your regarding the EXECUTE command Richard.  It's just
>too annoying to see that "transformation pending" status at the
>status bar.  You either have to submit an EXECUTE command, run a
>procedure or save the dataset to get rid of it.
>
>
>
>At 01:02 PM 9/5/2007, Richard Ristow wrote:
> >At 11:09 AM 9/5/2007, stace swayne had written:
> >
> >>I have a series of variables that are dates, but they are broken
> >>down by var1month, var1year, var2month, var2year,. I would like to
> >>combine the month and year variables into one variable.
> >
> >At 12:10 PM 9/5/2007, Florio Arguillas wrote:
> >
> >>Here's one option using the DATE.MOYR function.   Submit this sample
code.

> >>
> >>compute month1 = 12.
> >>compute month2 = 1.
> >>compute year1 = 1998.
> >>compute year2 = 1999.
> >>execute.
> >>
> >>COMPUTE month1year1 = DATE.MOYR(month1,year1) .
> >>FORMAT month1year1 (moyr).
> >>EXECUTE .
> >
> >Of the two suggestions, I think this is considerably the preferable.
> >Date values in SPSS files should almost always be SPSS-format dates,
> >as this does.
> >
> >And, since I haven't said it recently: the EXECUTE statements are
> >not necessary, do nothing useful, and may slow processing
> >considerably in a large file.
> >
> >-Good luck and good wishes,
> >  Richard
Reply | Threaded
Open this post in threaded view
|

Re: Question on dealing with dates in variables

Oliver, Richard
In reply to this post by ViAnn Beadle
Back to the original issue, if there are multiple dates, then you can simplify the code with DO REPEAT, as in:

do repeat
   yearvar=var1year var2year var3year
  /monthvar=var1month var2month var3month
  /datevar=newdate1 newdate2 newdate3.
compute datevar=date.moyr(monthvar, yearvar).
end repeat.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of ViAnn Beadle
Sent: Wednesday, September 05, 2007 12:40 PM
To: [hidden email]
Subject: Re: Question on dealing with dates in variables

That seems to be a minor reason for forcing unnecessary passes of data--if
the message bothers you so much you can turn off the status bar.

And I am in total agreement with Richard on the issue of maintaining a date
as a date variable, especially if you ever want to do arithmetic on dates

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Florio Arguillas
Sent: Wednesday, September 05, 2007 11:29 AM
To: [hidden email]
Subject: Re: Question on dealing with dates in variables

I agree with your regarding the EXECUTE command Richard.  It's just
too annoying to see that "transformation pending" status at the
status bar.  You either have to submit an EXECUTE command, run a
procedure or save the dataset to get rid of it.



At 01:02 PM 9/5/2007, Richard Ristow wrote:

>At 11:09 AM 9/5/2007, stace swayne had written:
>
>>I have a series of variables that are dates, but they are broken
>>down by var1month, var1year, var2month, var2year,. I would like to
>>combine the month and year variables into one variable.
>
>At 12:10 PM 9/5/2007, Florio Arguillas wrote:
>
>>Here's one option using the DATE.MOYR function.   Submit this sample code.
>>
>>compute month1 = 12.
>>compute month2 = 1.
>>compute year1 = 1998.
>>compute year2 = 1999.
>>execute.
>>
>>COMPUTE month1year1 = DATE.MOYR(month1,year1) .
>>FORMAT month1year1 (moyr).
>>EXECUTE .
>
>Of the two suggestions, I think this is considerably the preferable.
>Date values in SPSS files should almost always be SPSS-format dates,
>as this does.
>
>And, since I haven't said it recently: the EXECUTE statements are
>not necessary, do nothing useful, and may slow processing
>considerably in a large file.
>
>-Good luck and good wishes,
>  Richard
Reply | Threaded
Open this post in threaded view
|

Re: Question on dealing with dates in variables

Richard Ristow
In reply to this post by Florio Arguillas
At 01:54 PM 9/5/2007, Florio Arguillas wrote:

>Actually another reason [for using EXECUTE commands] is that if you do
>not run an execute command, a procedure, or save the data set, you
>can't see the values of the new variable you created in the Data
>Editor window.

Sure. That's a reason for using EXECUTE, *sometimes*. (Or using menu
"Transform> Run Pending Transformations".)

It's almost never a reason for including EXECUTE in syntax, since the
syntax generally includes a use for the data, and that use will also
cause all transformations to be carried out.

>If you have another way of immediately displaying the values of the
>newly created variables in the Data Editor after submitting a COMPUTE
>command without doing any of those three above, please tell me.

There's no way to display the results of a transformation without
carrying out the transformation (surprise). And that requires a pass
through the data file: a procedure, or a SAVE. (EXECUTE is a procedure
that does nothing.)

Now, if you're clicking up transformations from the menus, and want to
see the results before going on, it makes sense to click "Run pending
transformations" between steps. But, again: those EXECUTE statements
aren't necessary, aren't helpful, and can slow processing badly, if you
leave them in the syntax.
Reply | Threaded
Open this post in threaded view
|

Dates and older versions of SPSS (was Question on dealing with dates in variables)

ViAnn Beadle
In reply to this post by Ornelas, Fermin
What version of SPSS are you talking about? Unless somebody has a manual for
that version, it's a bit unlikely you'll get the syntax that works with that
version from this list.

The solution really depends upon whether the value is just a number or a
string.

1. You'll probably have to split the value into a year variable, month
variable, and date variable. How you do that depends upon whether you're
dealing with a string or a number.

2. Then use the YRMODA function to create a date variable out of it and

3. use the ADATE format to format that value.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Ornelas, Fermin
Sent: Wednesday, September 05, 2007 11:19 AM
To: [hidden email]
Subject: Re: Question on dealing with dates in variables

I am going to tag along this answer/question.
In my mainframe version I have two dates formatted as yyyymmdd and
yyyymm.
(20070605 200706). What I would like is to output these as:

06/05/07 and 06/01/07


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Richard Ristow
Sent: Wednesday, September 05, 2007 10:02 AM
To: [hidden email]
Subject: Re: Question on dealing with dates in variables

At 11:09 AM 9/5/2007, stace swayne had written:

>I have a series of variables that are dates, but they are broken down
>by var1month, var1year, var2month, var2year,. I would like to combine
>the month and year variables into one variable.

At 12:10 PM 9/5/2007, Florio Arguillas wrote:

>Here's one option using the DATE.MOYR function.   Submit this sample
>code.
>
>compute month1 = 12.
>compute month2 = 1.
>compute year1 = 1998.
>compute year2 = 1999.
>execute.
>
>COMPUTE month1year1 = DATE.MOYR(month1,year1) .
>FORMAT month1year1 (moyr).
>EXECUTE .

Of the two suggestions, I think this is considerably the preferable.
Date values in SPSS files should almost always be SPSS-format dates, as
this does.

And, since I haven't said it recently: the EXECUTE statements are not
necessary, do nothing useful, and may slow processing considerably in a
large file.

-Good luck and good wishes,
  Richard

NOTICE: This e-mail (and any attachments) may contain PRIVILEGED OR
CONFIDENTIAL information and is intended only for the use of the
specific individual(s) to whom it is addressed.  It may contain
information that is privileged and confidential under state and federal
law.  This information may be used or disclosed only in accordance with
law, and you may be subject to penalties under law for improper use or
further disclosure of the information in this e-mail and its
attachments. If you have received this e-mail in error, please
immediately notify the person named above by reply e-mail, and then
delete the original e-mail.  Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: dealing with dates in variables

Richard Ristow
In reply to this post by Richard Ristow
At 01:22 PM 9/5/2007, stace swayne wrote:

>I'll explain a little bit more about what I'm trying to do,
>
>for my problem the values for months are all different they range from
>1 to 12, and the year values range from 5 to 10 (i.e. 2005 to 2010).
>In the data set I have specmon (specialty month) people have a range
>of months 1-12, for specyr (specialty year) people range from 5 to 10
>(i.e 2005 to 2010).
>
>What I would like to do is have one variable that would like this...if
>the variable specmon = 5 and the specyr = 6, I would like to have a
>new variable that equaled 506 (i.e. the may 2006).

It sounds like our discussion on the List has ended up being confusing.
Florio's initial suggestions should do it, but see if this (very
similar) helps. It's tested; SPSS 15 draft output. You said you have
several sets of month-year variables. This code deals with two pair:
'spec' and 'grad' (date of graduation - I'm making that one up).

And I'm giving you the dates in two ways: as SPSS dates, and as
integers in form 'mmyy'. The latter is what you've asked for; the
former, I'd recommend. (For the 'mmyy' variables, I've used format N4,
to display leading zeroes.)

|-----------------------------|---------------------------|
|Output Created               |05-SEP-2007 16:18:52       |
|-----------------------------|---------------------------|
[swayne]

Name     specmon specyr gradmon gradyr

Alpha        8      5       1     10
Beta         5      5       1      6
Gamma       10      7       4     10
Delta       10      6      10      8
Epsilon      8      6       5      7
Zeta         1      7       3      8
Eta         11      7       9      9
Theta        2      6       8      9
Iota         7      7       6      8
Kappa        2      6       7      8

Number of cases read:  10    Number of cases listed:  10

*  ................................................................. .

NUMERIC    SpecDate (MOYR8)
            SpecDtNo (N4)
            GradDate (MOYR8)
            GradDtNo (N4).

VAR LABELS SpecDate "Date of specialization, as SPSS date value"
            SpecDtNo "Date of specialization, as integer 'mmyy'".
VAR LABELS GradDate "Date of specialization, as SPSS date value"
            GradDtNo "Date of specialization, as integer 'mmyy'".

DO REPEAT  MONTH    = specmon  gradmon
           /YEAR     = specyr   gradyr
           /SPSSdate = SpecDate GradDate
           /MMYY     = SpecDtNo GradDtNo.
.  COMPUTE SPSSdate = DATE.MOYR(MONTH,YEAR).
.  COMPUTE MMYY     = 100*MONTH + YEAR.
END REPEAT.

LIST.

List
|-----------------------------|---------------------------|
|Output Created               |05-SEP-2007 16:18:53       |
|-----------------------------|---------------------------|
[swayne]

Name     specmon specyr gradmon gradyr SpecDate SpecDtNo GradDate
GradDtNo

Alpha        8      5       1     10   AUG 2005   0805   JAN
2010   0110
Beta         5      5       1      6   MAY 2005   0505   JAN
2006   0106
Gamma       10      7       4     10   OCT 2007   1007   APR
2010   0410
Delta       10      6      10      8   OCT 2006   1006   OCT
2008   1008
Epsilon      8      6       5      7   AUG 2006   0806   MAY
2007   0507
Zeta         1      7       3      8   JAN 2007   0107   MAR
2008   0308
Eta         11      7       9      9   NOV 2007   1107   SEP
2009   0909
Theta        2      6       8      9   FEB 2006   0206   AUG
2009   0809
Iota         7      7       6      8   JUL 2007   0707   JUN
2008   0608
Kappa        2      6       7      8   FEB 2006   0206   JUL
2008   0708

Number of cases read:  10    Number of cases listed:  10

===================
APPENDIX: Test data
===================
*  ................................................................. .
*  .................   Test data               ..................... .

DATA LIST FIXED
    /Name    04-11 (A).
BEGIN DATA
1  Alpha
2  Beta
3  Gamma
4  Delta
5  Epsilon
6  Zeta
7  Eta
8  Theta
9  Iota
10 Kappa
END DATA.

SET RNG = MT       /* 'Mersenne twister' random number generator  */ .
SET MTINDEX = 0378 /*  Providence, RI telephone book              */ .

NUMERIC specmon specyr gradmon gradyr (F2).
COMPUTE specmon = TRUNC(RV.UNIFORM(01,13)).
COMPUTE specyr  = TRUNC(RV.UNIFORM(05,08)).
COMPUTE gradmon = TRUNC(RV.UNIFORM(01,13)).
COMPUTE gradyr  = TRUNC(RV.UNIFORM(specyr+1,11)).

DATASET NAME swayne WINDOW=FRONT.
LIST.
Reply | Threaded
Open this post in threaded view
|

Re: Dates and older versions of SPSS (was Question...)

Richard Ristow
In reply to this post by ViAnn Beadle
Addendum -

At 03:33 PM 9/5/2007, ViAnn Beadle wrote:

>What version of SPSS are you talking about? Unless somebody has a
>manual for that version, it's a bit unlikely you'll get the syntax
>that works with that version from this list.

Alternatively, can you get your data to a more current version of SPSS?

>The solution really depends upon whether the value is just a number or
>a string.
>
>1. You'll probably have to split the value into a year variable, month
>variable, and date variable. How you do that depends upon whether
>you're dealing with a string or a number.

Exactly so. So we'd need both that information and the SPSS version, to
help you.

Ornelas, you also wrote,

>>I have two dates formatted as yyyymmdd and yyyymm.

Are those different variables? If dates formatted both ways can occur
in the same variable, the code becomes a bit trickier. That's
especially so if the value is a number.

>2. Then use the YRMODA function to create a date variable out of it
>and
>3. use the ADATE format to format that value.

Unfortunately, that pair of suggestions probably won't work. YRMODA
produced a different output from the current SPSS date representation,
and it won't work with ADATE. If your version of SPSS has ADATE and
other modern date formats, you should also have functions DATE.MDY and
DATE.MOYR, and you should use one or both of those.


>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf
>Of
>Ornelas, Fermin
>Sent: Wednesday, September 05, 2007 11:19 AM
>To: [hidden email]
>Subject: Re: Question on dealing with dates in variables
>
>I am going to tag along this answer/question.
>In my mainframe version I have two dates formatted as yyyymmdd and
>yyyymm.
>(20070605 200706). What I would like is to output these as:
>
>06/05/07 and 06/01/07
>
>
>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf
>Of
>Richard Ristow
>Sent: Wednesday, September 05, 2007 10:02 AM
>To: [hidden email]
>Subject: Re: Question on dealing with dates in variables
>
>At 11:09 AM 9/5/2007, stace swayne had written:
>
> >I have a series of variables that are dates, but they are broken
> down
> >by var1month, var1year, var2month, var2year,. I would like to
> combine
> >the month and year variables into one variable.
>
>At 12:10 PM 9/5/2007, Florio Arguillas wrote:
>
> >Here's one option using the DATE.MOYR function.   Submit this sample
> >code.
> >
> >compute month1 = 12.
> >compute month2 = 1.
> >compute year1 = 1998.
> >compute year2 = 1999.
> >execute.
> >
> >COMPUTE month1year1 = DATE.MOYR(month1,year1) .
> >FORMAT month1year1 (moyr).
> >EXECUTE .
>
>Of the two suggestions, I think this is considerably the preferable.
>Date values in SPSS files should almost always be SPSS-format dates,
>as
>this does.
>
>And, since I haven't said it recently: the EXECUTE statements are not
>necessary, do nothing useful, and may slow processing considerably in
>a
>large file.
>
>-Good luck and good wishes,
>   Richard
>
>NOTICE: This e-mail (and any attachments) may contain PRIVILEGED OR
>CONFIDENTIAL information and is intended only for the use of the
>specific individual(s) to whom it is addressed.  It may contain
>information that is privileged and confidential under state and
>federal
>law.  This information may be used or disclosed only in accordance
>with
>law, and you may be subject to penalties under law for improper use or
>further disclosure of the information in this e-mail and its
>attachments. If you have received this e-mail in error, please
>immediately notify the person named above by reply e-mail, and then
>delete the original e-mail.  Thank you.
>
>
>
>--
>No virus found in this incoming message.
>Checked by AVG Free Edition.
>Version: 7.5.485 / Virus Database: 269.13.6/991 - Release Date:
>9/5/2007 2:55 PM
Reply | Threaded
Open this post in threaded view
|

Re: Dates and older versions of SPSS (was Question...)

Ornelas, Fermin
>Alternatively, can you get your data to a more current version of SPSS?

This is just wishful thinking. We kid around that the tech support
person is already at a nursing home (no pundit intended).

I have tried some tricks but had no luck. Here is a sample of the
output:
    ISSDATE     IDATEF

 06/03/1583 10/15/1582
 06/03/1583 10/15/1582
 06/03/1583 10/15/1582
 06/03/1583 10/15/1582
 06/03/1583 10/15/1582
 06/03/1583 10/15/1582
 06/03/1583 10/15/1582

Actual Dates
20070720
20070717
20070705
20070711
20070711
20070706
20070705

These are not good conversions. The statements follow:
STRING IDATE (A8)
COMPUTE IDATE=STRING(ISSDATE,F8.0)
STRING IYEAR (A4)
STRING IMNTH (A2)
STRING IDAY  (A2)
COMPUTE IYEAR=SUBSTR(IDATE,1,4)
COMPUTE IMNTH=SUBSTR(IDATE,5,2)
COMPUTE IDAY =SUBSTR(IDATE,7,2)
NUMERIC  YEAR (F4.0)
COMPUTE YEAR=NUMERIC(IYEAR,F4)
NUMERIC  MNTH (F2.0)
COMPUTE MNTH=NUMERIC(IMNTH,F2)
NUMERIC  DAY (F2.0)
COMPUTE  DAY=NUMERIC(IDAY,F2)
COMPUTE IDATEF=YRMODA(YEAR,MNTH,DAY)
FORMAT ISSDATE(ADATE)
FORMAT IDATEF(ADATE)

Note that the first format uses the date as it is in the file (yyyymmdd)


The MF version is 4.2.

-----Original Message-----
From: Richard Ristow [mailto:[hidden email]]
Sent: Wednesday, September 05, 2007 2:05 PM
To: ViAnn Beadle; [hidden email]
Cc: Ornelas, Fermin
Subject: Re: Dates and older versions of SPSS (was Question...)

Addendum -

At 03:33 PM 9/5/2007, ViAnn Beadle wrote:

>What version of SPSS are you talking about? Unless somebody has a
>manual for that version, it's a bit unlikely you'll get the syntax
>that works with that version from this list.

Alternatively, can you get your data to a more current version of SPSS?

>The solution really depends upon whether the value is just a number or
>a string.
>
>1. You'll probably have to split the value into a year variable, month
>variable, and date variable. How you do that depends upon whether
>you're dealing with a string or a number.

Exactly so. So we'd need both that information and the SPSS version, to
help you.

Ornelas, you also wrote,

>>I have two dates formatted as yyyymmdd and yyyymm.

Are those different variables? If dates formatted both ways can occur
in the same variable, the code becomes a bit trickier. That's
especially so if the value is a number.

>2. Then use the YRMODA function to create a date variable out of it
>and
>3. use the ADATE format to format that value.

Unfortunately, that pair of suggestions probably won't work. YRMODA
produced a different output from the current SPSS date representation,
and it won't work with ADATE. If your version of SPSS has ADATE and
other modern date formats, you should also have functions DATE.MDY and
DATE.MOYR, and you should use one or both of those.


>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf
>Of
>Ornelas, Fermin
>Sent: Wednesday, September 05, 2007 11:19 AM
>To: [hidden email]
>Subject: Re: Question on dealing with dates in variables
>
>I am going to tag along this answer/question.
>In my mainframe version I have two dates formatted as yyyymmdd and
>yyyymm.
>(20070605 200706). What I would like is to output these as:
>
>06/05/07 and 06/01/07
>
>
>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf
>Of
>Richard Ristow
>Sent: Wednesday, September 05, 2007 10:02 AM
>To: [hidden email]
>Subject: Re: Question on dealing with dates in variables
>
>At 11:09 AM 9/5/2007, stace swayne had written:
>
> >I have a series of variables that are dates, but they are broken
> down
> >by var1month, var1year, var2month, var2year,. I would like to
> combine
> >the month and year variables into one variable.
>
>At 12:10 PM 9/5/2007, Florio Arguillas wrote:
>
> >Here's one option using the DATE.MOYR function.   Submit this sample
> >code.
> >
> >compute month1 = 12.
> >compute month2 = 1.
> >compute year1 = 1998.
> >compute year2 = 1999.
> >execute.
> >
> >COMPUTE month1year1 = DATE.MOYR(month1,year1) .
> >FORMAT month1year1 (moyr).
> >EXECUTE .
>
>Of the two suggestions, I think this is considerably the preferable.
>Date values in SPSS files should almost always be SPSS-format dates,
>as
>this does.
>
>And, since I haven't said it recently: the EXECUTE statements are not
>necessary, do nothing useful, and may slow processing considerably in
>a
>large file.
>
>-Good luck and good wishes,
>   Richard
>
>NOTICE: This e-mail (and any attachments) may contain PRIVILEGED OR
>CONFIDENTIAL information and is intended only for the use of the
>specific individual(s) to whom it is addressed.  It may contain
>information that is privileged and confidential under state and
>federal
>law.  This information may be used or disclosed only in accordance
>with
>law, and you may be subject to penalties under law for improper use or
>further disclosure of the information in this e-mail and its
>attachments. If you have received this e-mail in error, please
>immediately notify the person named above by reply e-mail, and then
>delete the original e-mail.  Thank you.
>
>
>
>--
>No virus found in this incoming message.
>Checked by AVG Free Edition.
>Version: 7.5.485 / Virus Database: 269.13.6/991 - Release Date:
>9/5/2007 2:55 PM
Reply | Threaded
Open this post in threaded view
|

Re: Dates and older versions of SPSS (was Question...)

ViAnn Beadle
OK, I as Richard pointed out in another email, misremembered the results of
YRMODA--sorry about that. Your date is being calculated as the number of
seconds after 12:00 AM 10/15/1582. Nothing comes to mind for getting a true
date from these data with the version of SPSS you are using. Now if your
original data were in a database and somebody wrote them out as a text with
a date format using delimiters, you'd have a chance. Given the archaic
version of SPSS sounds to me like the state of Arizona is stuck back in the
70s when it comes to IT.

-----Original Message-----
From: Ornelas, Fermin [mailto:[hidden email]]
Sent: Wednesday, September 05, 2007 3:30 PM
To: Richard Ristow; ViAnn Beadle; [hidden email]
Subject: RE: Dates and older versions of SPSS (was Question...)

>Alternatively, can you get your data to a more current version of SPSS?

This is just wishful thinking. We kid around that the tech support
person is already at a nursing home (no pundit intended).

I have tried some tricks but had no luck. Here is a sample of the
output:
    ISSDATE     IDATEF

 06/03/1583 10/15/1582
 06/03/1583 10/15/1582
 06/03/1583 10/15/1582
 06/03/1583 10/15/1582
 06/03/1583 10/15/1582
 06/03/1583 10/15/1582
 06/03/1583 10/15/1582

Actual Dates
20070720
20070717
20070705
20070711
20070711
20070706
20070705

These are not good conversions. The statements follow:
STRING IDATE (A8)
COMPUTE IDATE=STRING(ISSDATE,F8.0)
STRING IYEAR (A4)
STRING IMNTH (A2)
STRING IDAY  (A2)
COMPUTE IYEAR=SUBSTR(IDATE,1,4)
COMPUTE IMNTH=SUBSTR(IDATE,5,2)
COMPUTE IDAY =SUBSTR(IDATE,7,2)
NUMERIC  YEAR (F4.0)
COMPUTE YEAR=NUMERIC(IYEAR,F4)
NUMERIC  MNTH (F2.0)
COMPUTE MNTH=NUMERIC(IMNTH,F2)
NUMERIC  DAY (F2.0)
COMPUTE  DAY=NUMERIC(IDAY,F2)
COMPUTE IDATEF=YRMODA(YEAR,MNTH,DAY)
FORMAT ISSDATE(ADATE)
FORMAT IDATEF(ADATE)

Note that the first format uses the date as it is in the file (yyyymmdd)


The MF version is 4.2.

-----Original Message-----
From: Richard Ristow [mailto:[hidden email]]
Sent: Wednesday, September 05, 2007 2:05 PM
To: ViAnn Beadle; [hidden email]
Cc: Ornelas, Fermin
Subject: Re: Dates and older versions of SPSS (was Question...)

Addendum -

At 03:33 PM 9/5/2007, ViAnn Beadle wrote:

>What version of SPSS are you talking about? Unless somebody has a
>manual for that version, it's a bit unlikely you'll get the syntax
>that works with that version from this list.

Alternatively, can you get your data to a more current version of SPSS?

>The solution really depends upon whether the value is just a number or
>a string.
>
>1. You'll probably have to split the value into a year variable, month
>variable, and date variable. How you do that depends upon whether
>you're dealing with a string or a number.

Exactly so. So we'd need both that information and the SPSS version, to
help you.

Ornelas, you also wrote,

>>I have two dates formatted as yyyymmdd and yyyymm.

Are those different variables? If dates formatted both ways can occur
in the same variable, the code becomes a bit trickier. That's
especially so if the value is a number.

>2. Then use the YRMODA function to create a date variable out of it
>and
>3. use the ADATE format to format that value.

Unfortunately, that pair of suggestions probably won't work. YRMODA
produced a different output from the current SPSS date representation,
and it won't work with ADATE. If your version of SPSS has ADATE and
other modern date formats, you should also have functions DATE.MDY and
DATE.MOYR, and you should use one or both of those.


>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf
>Of
>Ornelas, Fermin
>Sent: Wednesday, September 05, 2007 11:19 AM
>To: [hidden email]
>Subject: Re: Question on dealing with dates in variables
>
>I am going to tag along this answer/question.
>In my mainframe version I have two dates formatted as yyyymmdd and
>yyyymm.
>(20070605 200706). What I would like is to output these as:
>
>06/05/07 and 06/01/07
>
>
>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf
>Of
>Richard Ristow
>Sent: Wednesday, September 05, 2007 10:02 AM
>To: [hidden email]
>Subject: Re: Question on dealing with dates in variables
>
>At 11:09 AM 9/5/2007, stace swayne had written:
>
> >I have a series of variables that are dates, but they are broken
> down
> >by var1month, var1year, var2month, var2year,. I would like to
> combine
> >the month and year variables into one variable.
>
>At 12:10 PM 9/5/2007, Florio Arguillas wrote:
>
> >Here's one option using the DATE.MOYR function.   Submit this sample
> >code.
> >
> >compute month1 = 12.
> >compute month2 = 1.
> >compute year1 = 1998.
> >compute year2 = 1999.
> >execute.
> >
> >COMPUTE month1year1 = DATE.MOYR(month1,year1) .
> >FORMAT month1year1 (moyr).
> >EXECUTE .
>
>Of the two suggestions, I think this is considerably the preferable.
>Date values in SPSS files should almost always be SPSS-format dates,
>as
>this does.
>
>And, since I haven't said it recently: the EXECUTE statements are not
>necessary, do nothing useful, and may slow processing considerably in
>a
>large file.
>
>-Good luck and good wishes,
>   Richard
>
>NOTICE: This e-mail (and any attachments) may contain PRIVILEGED OR
>CONFIDENTIAL information and is intended only for the use of the
>specific individual(s) to whom it is addressed.  It may contain
>information that is privileged and confidential under state and
>federal
>law.  This information may be used or disclosed only in accordance
>with
>law, and you may be subject to penalties under law for improper use or
>further disclosure of the information in this e-mail and its
>attachments. If you have received this e-mail in error, please
>immediately notify the person named above by reply e-mail, and then
>delete the original e-mail.  Thank you.
>
>
>
>--
>No virus found in this incoming message.
>Checked by AVG Free Edition.
>Version: 7.5.485 / Virus Database: 269.13.6/991 - Release Date:
>9/5/2007 2:55 PM
Reply | Threaded
Open this post in threaded view
|

Re: Dates and older versions of SPSS (was Question...)

Fry, Jonathan B.
In reply to this post by Ornelas, Fermin
YRMODA returns the number of days since 15 Oct 1582, while the date formats expect the number of seconds since the same date.  So you can convert YRMODA output to standard date representation by multiplying by 24*60*60, or 86,400.

If you have date formats, you probably have date functions as well.  So a sequence like this should work.  (If not, substitute 86400*YRMODA for DATE.YMD.)

COMPUTE #YR = TRUNC(ISSDATE/1E4)
COMPUTE #MO = TRUNC(MOD(ISSDATE,1E4)/1E2)
COMPUTE #DA = MOD(ISSDATE,1E2)
COMPUTE IDATE = DATE.YMD(#YR,#MO,#DA)

That works because

        MOD(X,1En) returns the last n decimal digits of an integer, and
        TRUNC(X/1En) returns all but the last n decimal digits of a number.

Jonathan Fry
SPSS Inc.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Ornelas, Fermin
Sent: Wednesday, September 05, 2007 4:30 PM
To: [hidden email]
Subject: Re: Dates and older versions of SPSS (was Question...)

>Alternatively, can you get your data to a more current version of SPSS?

This is just wishful thinking. We kid around that the tech support
person is already at a nursing home (no pundit intended).

I have tried some tricks but had no luck. Here is a sample of the
output:
    ISSDATE     IDATEF

 06/03/1583 10/15/1582
 06/03/1583 10/15/1582
 06/03/1583 10/15/1582
 06/03/1583 10/15/1582
 06/03/1583 10/15/1582
 06/03/1583 10/15/1582
 06/03/1583 10/15/1582

Actual Dates
20070720
20070717
20070705
20070711
20070711
20070706
20070705

These are not good conversions. The statements follow:
STRING IDATE (A8)
COMPUTE IDATE=STRING(ISSDATE,F8.0)
STRING IYEAR (A4)
STRING IMNTH (A2)
STRING IDAY  (A2)
COMPUTE IYEAR=SUBSTR(IDATE,1,4)
COMPUTE IMNTH=SUBSTR(IDATE,5,2)
COMPUTE IDAY =SUBSTR(IDATE,7,2)
NUMERIC  YEAR (F4.0)
COMPUTE YEAR=NUMERIC(IYEAR,F4)
NUMERIC  MNTH (F2.0)
COMPUTE MNTH=NUMERIC(IMNTH,F2)
NUMERIC  DAY (F2.0)
COMPUTE  DAY=NUMERIC(IDAY,F2)
COMPUTE IDATEF=YRMODA(YEAR,MNTH,DAY)
FORMAT ISSDATE(ADATE)
FORMAT IDATEF(ADATE)

Note that the first format uses the date as it is in the file (yyyymmdd)


The MF version is 4.2.

-----Original Message-----
From: Richard Ristow [mailto:[hidden email]]
Sent: Wednesday, September 05, 2007 2:05 PM
To: ViAnn Beadle; [hidden email]
Cc: Ornelas, Fermin
Subject: Re: Dates and older versions of SPSS (was Question...)

Addendum -

At 03:33 PM 9/5/2007, ViAnn Beadle wrote:

>What version of SPSS are you talking about? Unless somebody has a
>manual for that version, it's a bit unlikely you'll get the syntax
>that works with that version from this list.

Alternatively, can you get your data to a more current version of SPSS?

>The solution really depends upon whether the value is just a number or
>a string.
>
>1. You'll probably have to split the value into a year variable, month
>variable, and date variable. How you do that depends upon whether
>you're dealing with a string or a number.

Exactly so. So we'd need both that information and the SPSS version, to
help you.

Ornelas, you also wrote,

>>I have two dates formatted as yyyymmdd and yyyymm.

Are those different variables? If dates formatted both ways can occur
in the same variable, the code becomes a bit trickier. That's
especially so if the value is a number.

>2. Then use the YRMODA function to create a date variable out of it
>and
>3. use the ADATE format to format that value.

Unfortunately, that pair of suggestions probably won't work. YRMODA
produced a different output from the current SPSS date representation,
and it won't work with ADATE. If your version of SPSS has ADATE and
other modern date formats, you should also have functions DATE.MDY and
DATE.MOYR, and you should use one or both of those.


>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf
>Of
>Ornelas, Fermin
>Sent: Wednesday, September 05, 2007 11:19 AM
>To: [hidden email]
>Subject: Re: Question on dealing with dates in variables
>
>I am going to tag along this answer/question.
>In my mainframe version I have two dates formatted as yyyymmdd and
>yyyymm.
>(20070605 200706). What I would like is to output these as:
>
>06/05/07 and 06/01/07
>
>
>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf
>Of
>Richard Ristow
>Sent: Wednesday, September 05, 2007 10:02 AM
>To: [hidden email]
>Subject: Re: Question on dealing with dates in variables
>
>At 11:09 AM 9/5/2007, stace swayne had written:
>
> >I have a series of variables that are dates, but they are broken
> down
> >by var1month, var1year, var2month, var2year,. I would like to
> combine
> >the month and year variables into one variable.
>
>At 12:10 PM 9/5/2007, Florio Arguillas wrote:
>
> >Here's one option using the DATE.MOYR function.   Submit this sample
> >code.
> >
> >compute month1 = 12.
> >compute month2 = 1.
> >compute year1 = 1998.
> >compute year2 = 1999.
> >execute.
> >
> >COMPUTE month1year1 = DATE.MOYR(month1,year1) .
> >FORMAT month1year1 (moyr).
> >EXECUTE .
>
>Of the two suggestions, I think this is considerably the preferable.
>Date values in SPSS files should almost always be SPSS-format dates,
>as
>this does.
>
>And, since I haven't said it recently: the EXECUTE statements are not
>necessary, do nothing useful, and may slow processing considerably in
>a
>large file.
>
>-Good luck and good wishes,
>   Richard
>
>NOTICE: This e-mail (and any attachments) may contain PRIVILEGED OR
>CONFIDENTIAL information and is intended only for the use of the
>specific individual(s) to whom it is addressed.  It may contain
>information that is privileged and confidential under state and
>federal
>law.  This information may be used or disclosed only in accordance
>with
>law, and you may be subject to penalties under law for improper use or
>further disclosure of the information in this e-mail and its
>attachments. If you have received this e-mail in error, please
>immediately notify the person named above by reply e-mail, and then
>delete the original e-mail.  Thank you.
>
>
>
>--
>No virus found in this incoming message.
>Checked by AVG Free Edition.
>Version: 7.5.485 / Virus Database: 269.13.6/991 - Release Date:
>9/5/2007 2:55 PM
Reply | Threaded
Open this post in threaded view
|

Re: Dates and older versions of SPSS (was Question...)

Richard Ristow
In reply to this post by Ornelas, Fermin
At 05:30 PM 9/5/2007, Ornelas, Fermin wrote:

>The MF version is 4.2.

I'm going to guess this is SPSSX version 4.2 (c. 1990). There was an
earlier SPSS release 4 in the first half of the 1970s, but I trust you
don't have *that*.

>>Alternatively, can you get your data to a more current version of
>>SPSS?
>
>This is just wishful thinking.

Ah, they can't shoot you for hoping.

>I have tried some tricks but had no luck. Here is a sample of the
>output:

Years around 1582-1583 are suggestive, as both SPSS date
representations start counting at 15 October 1582 - the YRMODA
representation counts in days, the modern representation in seconds.
(You probably only have the former.) So something odd, but probably
diagnosable, happened *creating* those variables.

Anyway, almost any conversion can be handled, but we need to have,
exactly,
. What you are starting with
. What are the values you want
. What transformations you have tried.

You list,

>     ISSDATE     IDATEF
>
>  06/03/1583 10/15/1582
>  06/03/1583 10/15/1582
>  06/03/1583 10/15/1582
>  06/03/1583 10/15/1582
>  06/03/1583 10/15/1582
>  06/03/1583 10/15/1582
>  06/03/1583 10/15/1582

You don't say, so I'm guessing from the code you send.

Is ISSDATE the variable you're *starting* with? If so, is it string or
numeric? If numeric, what format are you printing it with? Could you
list a few values, printed both with whatever format you are using and
with a nice long format like COMMA15.2, so we can see their exact
values as integers?

>Actual Dates
>20070720
>20070717
>20070705
>20070711
>20070711
>20070706
>20070705

And those are what you want to convert ISSDATE to?

(Here, a rule for questions about transformations: make clear what was
input to the transformations; what was output; what was the output you
wanted or expected; and what transformations you ran.)

>These are not good conversions. The statements follow:
>STRING IDATE (A8)
>COMPUTE IDATE=STRING(ISSDATE,F8.0)

That makes it look like ISSDATE is a numeric variable. But we'd need
its exact numeric value to go farther (see above), and I don't see how
to get that from the listing you sent.

BUT, your problem is almost certainly soluble.

At the end, you have

>COMPUTE IDATEF=YRMODA(YEAR,MNTH,DAY)
>FORMAT ISSDATE(ADATE)
>FORMAT IDATEF(ADATE)

Now, I only have SPSSX documentation for releases 1 and 2, and those
don't seem to have the ADATE format. But it's suggestive that your
values, if you print them with ADATE format, appear to be in 1582 or
1583. That means their value is much too low; and that could mean
they're in the old YRMODA representation (number of days since October
14, 1582) rather than the current one (number of seconds since October
14, 1582). Just multiplying by 86,400 might give you the right values.

-Onward,
  Richard
12