| Date: | Fri, 10 Jun 2005 01:48:16 -0400 |
| Reply-To: | Richard Ristow <wrristow@mindspring.com> |
| Sender: | "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU> |
| From: | Richard Ristow <wrristow@mindspring.com> |
| Subject: | Re: date define and time series |
|
| In-Reply-To: | <E619BDBD99B4F74D9DCA32F43BE92671012B6E5F@XCH-VN02.sph.ad.j
hsph.edu> |
| Content-Type: | text/plain; charset="us-ascii"; format=flowed |
|---|
On this one, it will help if we can clarify a few points.
At 04:53 PM 6/9/2005, Kimberly Ashburn wrote:
>I am trying to write syntax to define a custom date set up in the
>format dd/mm/yy.
It is easy to create a date variable that displays in that format:
NUMERIC CUSTM_DT (ADATE8).
Alternatively,
NUMERIC CUSTM_DT (ADATE10).
will display as mm/dd/yyyy (4-digit year).
Now:
Will you have one date per record, or several?
Are you reading these dates from an external file? Or are you writing
syntax to write a record for each date over a time interval? Or, what
else?
That is: where do you get the dates themselves (not the variable
they're recorded in), and what do they mean?
>I am trying to distinguish by day as people were recruited into the
>study daily but the measures we are tracking were taken daily.
You've probably got a misprint here: one of those "daily"s should
probably be "weekly".
>I don't understand how to set periodicity then for days that are
>sometimes 30 a month and sometimes 31. We also have weekend dates
>missing. Does anyone know what the syntax might look like? Any
>suggestions are greatly appreciated.
If you are using SPSS date variables (as you should be), it's very easy
to create a series, because they increment uniformly. Here's code to
write a series of dates. But I'm not sure it's what you want, and I
don't know what you want done about weekend dates. It's tested, though;
SPSS draft output:
* Write all dates from 27 Jan 2005 to 3 March 2005: .
NEW FILE.
INPUT PROGRAM.
NUMERIC CUSTM_DT (ADATE8).
NUMERIC #START #END (ADATE8).
COMPUTE #START=DATE.MDY(01,27,2005).
COMPUTE #END =DATE.MDY(03,03,2005).
. /**/ NUMERIC #INTVL (F5).
. /**/ COMPUTE #INTVL = CTIME.DAYS(#END-#START).
. /**/ PRINT / #START #END #INTVL ' days'.
LOOP CUSTM_DT = #START TO #END BY TIME.DAYS(1).
. /*-- PRINT /CUSTM_DT.
. END CASE.
END LOOP.
END FILE.
END INPUT PROGRAM.
LIST.
List
Notes
|---------------------|--------------------|
|Output Created |10 Jun 05 01:44:36 |
|---------------------|--------------------|
01/27/05 03/03/05 35 days
CUSTM_DT
01/27/05
01/28/05
01/29/05
01/30/05
01/31/05
02/01/05
02/02/05
02/03/05
02/04/05
02/05/05
02/06/05
02/07/05
02/08/05
02/09/05
02/10/05
02/11/05
02/12/05
02/13/05
02/14/05
02/15/05
02/16/05
02/17/05
02/18/05
02/19/05
02/20/05
02/21/05
02/22/05
02/23/05
02/24/05
02/25/05
02/26/05
02/27/05
02/28/05
03/01/05
03/02/05
03/03/05
Number of cases read: 36 Number of cases listed: 36
|