Adding Months to a Date w Loop

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

Adding Months to a Date w Loop

JEFFREY CANTER
All,

First time posting to the list so please excuse any errors.  I'm trying to create time spans that go along with service dates.  The time span is six months counting from the month that the service date occurs.  For example if a service date is Jan 15, 2008 the span is Jan 2008 to Jun 2008.   For Oct 7, 2007 the span should be Oct 2007 to Mar 2008.  Please keep in mind that the span can be any number of months so I need something that will work for any scenario up to and including 11 months.  I've figured years out, or so I think.

For six months the following code works for all months except for Sept, Oct, and Nov. What's baffling is that August and December work ok.  It appears to work in every instance if the number of months is two or less.  Anything larger and it fails.

sort cases by RecipientID  PaytoProvID  ServiceDate.

match files file *
        /by RecipientID  PaytoProvID
        /first=span.
exe.


if span eq 1 SpanBegins=ServiceMonthYear.
if span eq 1 and (xdate.month(ServiceMonthYear)=12 )
        SpanEnds=date.moyr(5,ServiceYear+1).
if span eq 1 and xdate.month(ServiceMonthYear) ne 12
        SpanEnds=date.moyr((xdate.month(ServiceMonthYear)+5),xdate.year(ServiceMonthYear)).
formats SpanBegins SpanEnds (moyr10).
exe.

loop if (span eq 0).
if span eq 0 and (ServiceMonthYear ge lag(SpanBegins)) and (ServiceMonthYear le lag(SpanEnds)) SpanBegins=lag(SpanBegins).
if span eq 0 and (ServiceMonthYear ge lag(SpanBegins)) and (ServiceMonthYear le lag(SpanEnds)) SpanEnds=lag(SpanEnds).
if span eq 0 and (ServiceMonthYear ge lag(SpanBegins)) and (ServiceMonthYear le lag(SpanEnds)) Span=lag(Span).
if span eq 0 and (ServiceMonthYear ge lag(SpanBegins)) and (ServiceMonthYear ge lag(SpanEnds))
        SpanBegins=ServiceMonthYear.
if span eq 0 and ServiceMonthYear ge lag(SpanEnds) and xdate.month(ServiceMonthYear) ne 12
        SpanEnds=date.moyr((xdate.month(ServiceMonthYear)+5),xdate.year(ServiceMonthYear)).
if span eq 0 and ServiceMonthYear ge lag(SpanEnds) and xdate.month(ServiceMonthYear) eq 12
        SpanEnds=date.moyr(5,ServiceYear+1).
if span eq 0 and (ServiceMonthYear ge SpanBegins) and (ServiceMonthYear le SpanEnds) Span=lag(Span)+1.
end loop.

I get the following error messages until I get the mxwarns message.

>Warning # 613
>One of the arguments to the DATE function is out of range or is not an
>integer.  The result has been set to the system-missing value.
>Command line: 105  Current case: 5  Current splitfile group: 1

I'm currently using version 17.0.2.

Thanks
Jeff



This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain private, confidential, and/or privileged information. Any unauthorized review, use, disclosure, or distribution is prohibited. If you are not the intended recipient, employee, or agent responsible for delivering this message, please contact the sender by reply e-mail and destroy all copies of the original e-mail message.

=====================
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: Adding Months to a Date w Loop

Maguin, Eugene
Jeff,

I don't think anyone has replied to your message. I'm guessing that you have
multiple records either per RecipientID or per RecipientID-PaytoProvID. But,
I'm guessing not per
RecipientID-PaytoProvID-ServiceDate combination. I'm guessing that it's per
RecipientID-PaytoProvID given the match files statement to identify the
first record in the group.

So your data might look like this before the time span date is added.

RecipientID  PaytoProvID  ServiceDate.
1234         7777         12/10/2008
1234         7777         01/05/2009
1234         8888         01/06/2009
1896         2222         11/14/2007
2004         3456         03/04/2009

So you add the date and then should your data look like this?

RecipientID  PaytoProvID  ServiceDate  TimeSpanDate
1234         7777         12/10/2008    05/2009
1234         7777         01/05/2009    06/2009
1234         8888         01/06/2009    06/2009
1896         2222         11/14/2007    04/2008
2004         3456         03/04/2009    08/2009

Probably I have this all wrong so fix up my understanding by fixing up my
example. Let's start here.

Gene Maguin

=====================
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: Adding Months to a Date w Loop

Marks, Jim
In reply to this post by JEFFREY CANTER
Jeffrey:

Your problem is in the values for month-- Sep, Oct, and Nov + 5 is
greater than 12.

You could expand your exceptions, or you could try something like this:

*not tested.

sort cases by RecipientID  PaytoProvID  ServiceDate.

match files file *
        /by RecipientID  PaytoProvID
        /first=span.
exe.


if span eq 1 SpanBegins=ServiceMonthYear.
if span eq 1 and (xdate.month(ServiceMonthYear) > 7 )

SpanEnds=date.moyr((xdate.month(ServiceMonthYear)-7),ServiceYear+1).
if span eq 1 and xdate.month(ServiceMonthYear) le 7

SpanEnds=date.moyr((xdate.month(ServiceMonthYear)+5),xdate.year(ServiceM
onthYear)).
formats SpanBegins SpanEnds (moyr10).
exe.

*use rest of code here.

This can be edited to account for different spans.

Jim Marks


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
JEFFREY CANTER
Sent: Wednesday, August 05, 2009 12:40 PM
To: [hidden email]
Subject: Adding Months to a Date w Loop

All,

First time posting to the list so please excuse any errors.  I'm trying
to create time spans that go along with service dates.  The time span is
six months counting from the month that the service date occurs.  For
example if a service date is Jan 15, 2008 the span is Jan 2008 to Jun
2008.   For Oct 7, 2007 the span should be Oct 2007 to Mar 2008.  Please
keep in mind that the span can be any number of months so I need
something that will work for any scenario up to and including 11 months.
I've figured years out, or so I think.

For six months the following code works for all months except for Sept,
Oct, and Nov. What's baffling is that August and December work ok.  It
appears to work in every instance if the number of months is two or
less.  Anything larger and it fails.

sort cases by RecipientID  PaytoProvID  ServiceDate.

match files file *
        /by RecipientID  PaytoProvID
        /first=span.
exe.


if span eq 1 SpanBegins=ServiceMonthYear.
if span eq 1 and (xdate.month(ServiceMonthYear)=12 )
        SpanEnds=date.moyr(5,ServiceYear+1).
if span eq 1 and xdate.month(ServiceMonthYear) ne 12

SpanEnds=date.moyr((xdate.month(ServiceMonthYear)+5),xdate.year(ServiceM
onthYear)).
formats SpanBegins SpanEnds (moyr10).
exe.

loop if (span eq 0).
if span eq 0 and (ServiceMonthYear ge lag(SpanBegins)) and
(ServiceMonthYear le lag(SpanEnds)) SpanBegins=lag(SpanBegins).
if span eq 0 and (ServiceMonthYear ge lag(SpanBegins)) and
(ServiceMonthYear le lag(SpanEnds)) SpanEnds=lag(SpanEnds).
if span eq 0 and (ServiceMonthYear ge lag(SpanBegins)) and
(ServiceMonthYear le lag(SpanEnds)) Span=lag(Span).
if span eq 0 and (ServiceMonthYear ge lag(SpanBegins)) and
(ServiceMonthYear ge lag(SpanEnds))
        SpanBegins=ServiceMonthYear.
if span eq 0 and ServiceMonthYear ge lag(SpanEnds) and
xdate.month(ServiceMonthYear) ne 12

SpanEnds=date.moyr((xdate.month(ServiceMonthYear)+5),xdate.year(ServiceM
onthYear)).
if span eq 0 and ServiceMonthYear ge lag(SpanEnds) and
xdate.month(ServiceMonthYear) eq 12
        SpanEnds=date.moyr(5,ServiceYear+1).
if span eq 0 and (ServiceMonthYear ge SpanBegins) and (ServiceMonthYear
le SpanEnds) Span=lag(Span)+1.
end loop.

I get the following error messages until I get the mxwarns message.

>Warning # 613
>One of the arguments to the DATE function is out of range or is not an
>integer.  The result has been set to the system-missing value.
>Command line: 105  Current case: 5  Current splitfile group: 1

I'm currently using version 17.0.2.

Thanks
Jeff



This e-mail message, including any attachments, is for the sole use of
the intended recipient(s) and may contain private, confidential, and/or
privileged information. Any unauthorized review, use, disclosure, or
distribution is prohibited. If you are not the intended recipient,
employee, or agent responsible for delivering this message, please
contact the sender by reply e-mail and destroy all copies of the
original e-mail message.

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

Propensity Score Matching vs Risk Adjustment

Allen Frommelt
In reply to this post by Maguin, Eugene
I am interested in conducting a propensity score matched study, but for a few of our conditions of interest, the pool of candidates for matching doesn't make it likely that I will be able to find matches for everyone.  Would risk adjusting provide most of the same effect?  I plan on using logistic regression to determine the likelihood of the outcomes of interest.

Thanks,

Allen

This email and all attachments are confidential and intended solely
for the use of the individual or entity to which they are addressed.
If you have received this email in error please notify the sender
by replying to this message. If you are not the intended recipient,
please delete this message and all attachments immediately.  Do not
copy, disclose, use or act upon the information contained. Please
note that any views or opinions presented in this email are solely
those of the author and do not necessarily represent those of the
company. Finally, the recipient should check this email and any
attachments for the presence of viruses. While every attempt is made
to verify that the contents are safe, the company accepts no liability
for any damage caused by any virus transmitted by this email.

=====================
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: Adding Months to a Date w Loop

JEFFREY CANTER
In reply to this post by Maguin, Eugene
Gene,

You are correct but a recipient provider combo can have the same service dates.  In other words it does happen.  Here's a modified version of what you put together. Basically what I'm seeing when I run the syntax.  I'm leaving out the SpanEnds dates that aren't populating.

RecipientID  PaytoProvID  ServiceDate  Span   SpanBegins    Span Ends
1234            7777               12/10/2008    1        Dec 2008      May 2009
1234            7777               01/05/2009    0
1234            8888               01/06/2009    0
1896            2222               11/14/2007    1        Nov 2007
2004            3456               03/04/2009    1        Mar 2009       Aug 2009

The 0 Spans don't populate until I run the loop syntax.

Here's what it should look like after it's completed.

RecipientID  PaytoProvID  ServiceDate  Span   SpanBegins    Span Ends
1234            7777               12/10/2008    1        Dec 2008      May 2009
1234            7777               01/05/2009    1        Dec 2008      May 2009
1234            8888               01/06/2009    1        Dec 2008      May 2009
1896            2222               11/14/2007    1        Nov 2007      Apr 2008
2004            3456               03/04/2009    1        Mar 2009      Aug 2009

Sorry, I should have provided and example.  I hope this helps.

Thanks
Jeff


>>> Gene Maguin <[hidden email]> 8/6/2009 10:42 AM >>>
Jeff,

I don't think anyone has replied to your message. I'm guessing that you have
multiple records either per RecipientID or per RecipientID-PaytoProvID. But,
I'm guessing not per
RecipientID-PaytoProvID-ServiceDate combination. I'm guessing that it's per
RecipientID-PaytoProvID given the match files statement to identify the
first record in the group.

So your data might look like this before the time span date is added.

RecipientID  PaytoProvID  ServiceDate.
1234         7777         12/10/2008
1234         7777         01/05/2009
1234         8888         01/06/2009
1896         2222         11/14/2007
2004         3456         03/04/2009

So you add the date and then should your data look like this?

RecipientID  PaytoProvID  ServiceDate  TimeSpanDate
1234         7777         12/10/2008    05/2009
1234         7777         01/05/2009    06/2009
1234         8888         01/06/2009    06/2009
1896         2222         11/14/2007    04/2008
2004         3456         03/04/2009    08/2009

Probably I have this all wrong so fix up my understanding by fixing up my
example. Let's start here.

Gene Maguin

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


This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain private, confidential, and/or privileged information. Any unauthorized review, use, disclosure, or distribution is prohibited. If you are not the intended recipient, employee, or agent responsible for delivering this message, please contact the sender by reply e-mail and destroy all copies of the original e-mail message.

=====================
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: Adding Months to a Date w Loop

mpirritano
In reply to this post by Marks, Jim
How about just using the datesum function? Then you don't have to do any
dividing of the date value into month and year.

compute SpanEnds = datesum(service_date,span,"months").
exe.

Matthew Pirritano, Ph.D.
Research Analyst IV
Medical Services Initiative (MSI)
Orange County Health Care Agency
(714) 568-5648
-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Marks, Jim
Sent: Thursday, August 06, 2009 7:46 AM
To: [hidden email]
Subject: Re: Adding Months to a Date w Loop

Jeffrey:

Your problem is in the values for month-- Sep, Oct, and Nov + 5 is
greater than 12.

You could expand your exceptions, or you could try something like this:

*not tested.

sort cases by RecipientID  PaytoProvID  ServiceDate.

match files file *
        /by RecipientID  PaytoProvID
        /first=span.
exe.


if span eq 1 SpanBegins=ServiceMonthYear.
if span eq 1 and (xdate.month(ServiceMonthYear) > 7 )

SpanEnds=date.moyr((xdate.month(ServiceMonthYear)-7),ServiceYear+1).
if span eq 1 and xdate.month(ServiceMonthYear) le 7

SpanEnds=date.moyr((xdate.month(ServiceMonthYear)+5),xdate.year(ServiceM
onthYear)).
formats SpanBegins SpanEnds (moyr10).
exe.

*use rest of code here.

This can be edited to account for different spans.

Jim Marks


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
JEFFREY CANTER
Sent: Wednesday, August 05, 2009 12:40 PM
To: [hidden email]
Subject: Adding Months to a Date w Loop

All,

First time posting to the list so please excuse any errors.  I'm trying
to create time spans that go along with service dates.  The time span is
six months counting from the month that the service date occurs.  For
example if a service date is Jan 15, 2008 the span is Jan 2008 to Jun
2008.   For Oct 7, 2007 the span should be Oct 2007 to Mar 2008.  Please
keep in mind that the span can be any number of months so I need
something that will work for any scenario up to and including 11 months.
I've figured years out, or so I think.

For six months the following code works for all months except for Sept,
Oct, and Nov. What's baffling is that August and December work ok.  It
appears to work in every instance if the number of months is two or
less.  Anything larger and it fails.

sort cases by RecipientID  PaytoProvID  ServiceDate.

match files file *
        /by RecipientID  PaytoProvID
        /first=span.
exe.


if span eq 1 SpanBegins=ServiceMonthYear.
if span eq 1 and (xdate.month(ServiceMonthYear)=12 )
        SpanEnds=date.moyr(5,ServiceYear+1).
if span eq 1 and xdate.month(ServiceMonthYear) ne 12

SpanEnds=date.moyr((xdate.month(ServiceMonthYear)+5),xdate.year(ServiceM
onthYear)).
formats SpanBegins SpanEnds (moyr10).
exe.

loop if (span eq 0).
if span eq 0 and (ServiceMonthYear ge lag(SpanBegins)) and
(ServiceMonthYear le lag(SpanEnds)) SpanBegins=lag(SpanBegins).
if span eq 0 and (ServiceMonthYear ge lag(SpanBegins)) and
(ServiceMonthYear le lag(SpanEnds)) SpanEnds=lag(SpanEnds).
if span eq 0 and (ServiceMonthYear ge lag(SpanBegins)) and
(ServiceMonthYear le lag(SpanEnds)) Span=lag(Span).
if span eq 0 and (ServiceMonthYear ge lag(SpanBegins)) and
(ServiceMonthYear ge lag(SpanEnds))
        SpanBegins=ServiceMonthYear.
if span eq 0 and ServiceMonthYear ge lag(SpanEnds) and
xdate.month(ServiceMonthYear) ne 12

SpanEnds=date.moyr((xdate.month(ServiceMonthYear)+5),xdate.year(ServiceM
onthYear)).
if span eq 0 and ServiceMonthYear ge lag(SpanEnds) and
xdate.month(ServiceMonthYear) eq 12
        SpanEnds=date.moyr(5,ServiceYear+1).
if span eq 0 and (ServiceMonthYear ge SpanBegins) and (ServiceMonthYear
le SpanEnds) Span=lag(Span)+1.
end loop.

I get the following error messages until I get the mxwarns message.

>Warning # 613
>One of the arguments to the DATE function is out of range or is not an
>integer.  The result has been set to the system-missing value.
>Command line: 105  Current case: 5  Current splitfile group: 1

I'm currently using version 17.0.2.

Thanks
Jeff



This e-mail message, including any attachments, is for the sole use of
the intended recipient(s) and may contain private, confidential, and/or
privileged information. Any unauthorized review, use, disclosure, or
distribution is prohibited. If you are not the intended recipient,
employee, or agent responsible for delivering this message, please
contact the sender by reply e-mail and destroy all copies of the
original e-mail message.

=====================
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: Adding Months to a Date w Loop

Maguin, Eugene
In reply to this post by JEFFREY CANTER
Jeff,

Matt is right that the datesum function is the thing to use here.

Based on your example data, the code I'd use would be (beginning following
the match files command).

Do if (span eq 1).
+  compute spanbegins=servicedate.
+  compute spanends=DATESUM(servicedate,5,"months","closest").
Else.
+  compute spanbegins=lag(spanbegins).
+  compute spanends=lag(spanends).
End if.
Format spanbegins spanends(moyr7).


Gene Maguin

=====================
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: Adding Months to a Date w Loop

JEFFREY CANTER
In reply to this post by Marks, Jim
Jim,

Thanks for the follow up.  I'm testing your code now and so far it's working.  I'm trying to test all of the different monthly scenarios and to determine what numbers need to be changed to what.  What doesn't make sense is why do Aug and Dec work.  Both months exceed 12 when you add five to them.  I must be missing something.

Thanks
Jeff

>>> "Marks, Jim" <[hidden email]> 8/6/2009 10:45 AM >>>
Jeffrey:

Your problem is in the values for month-- Sep, Oct, and Nov + 5 is
greater than 12.

You could expand your exceptions, or you could try something like this:

*not tested.

sort cases by RecipientID  PaytoProvID  ServiceDate.

match files file *
        /by RecipientID  PaytoProvID
        /first=span.
exe.


if span eq 1 SpanBegins=ServiceMonthYear.
if span eq 1 and (xdate.month(ServiceMonthYear) > 7 )

SpanEnds=date.moyr((xdate.month(ServiceMonthYear)-7),ServiceYear+1).
if span eq 1 and xdate.month(ServiceMonthYear) le 7

SpanEnds=date.moyr((xdate.month(ServiceMonthYear)+5),xdate.year(ServiceM
onthYear)).
formats SpanBegins SpanEnds (moyr10).
exe.

*use rest of code here.

This can be edited to account for different spans.

Jim Marks


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
JEFFREY CANTER
Sent: Wednesday, August 05, 2009 12:40 PM
To: [hidden email]
Subject: Adding Months to a Date w Loop

All,

First time posting to the list so please excuse any errors.  I'm trying
to create time spans that go along with service dates.  The time span is
six months counting from the month that the service date occurs.  For
example if a service date is Jan 15, 2008 the span is Jan 2008 to Jun
2008.   For Oct 7, 2007 the span should be Oct 2007 to Mar 2008.  Please
keep in mind that the span can be any number of months so I need
something that will work for any scenario up to and including 11 months.
I've figured years out, or so I think.

For six months the following code works for all months except for Sept,
Oct, and Nov. What's baffling is that August and December work ok.  It
appears to work in every instance if the number of months is two or
less.  Anything larger and it fails.

sort cases by RecipientID  PaytoProvID  ServiceDate.

match files file *
        /by RecipientID  PaytoProvID
        /first=span.
exe.


if span eq 1 SpanBegins=ServiceMonthYear.
if span eq 1 and (xdate.month(ServiceMonthYear)=12 )
        SpanEnds=date.moyr(5,ServiceYear+1).
if span eq 1 and xdate.month(ServiceMonthYear) ne 12

SpanEnds=date.moyr((xdate.month(ServiceMonthYear)+5),xdate.year(ServiceM
onthYear)).
formats SpanBegins SpanEnds (moyr10).
exe.

loop if (span eq 0).
if span eq 0 and (ServiceMonthYear ge lag(SpanBegins)) and
(ServiceMonthYear le lag(SpanEnds)) SpanBegins=lag(SpanBegins).
if span eq 0 and (ServiceMonthYear ge lag(SpanBegins)) and
(ServiceMonthYear le lag(SpanEnds)) SpanEnds=lag(SpanEnds).
if span eq 0 and (ServiceMonthYear ge lag(SpanBegins)) and
(ServiceMonthYear le lag(SpanEnds)) Span=lag(Span).
if span eq 0 and (ServiceMonthYear ge lag(SpanBegins)) and
(ServiceMonthYear ge lag(SpanEnds))
        SpanBegins=ServiceMonthYear.
if span eq 0 and ServiceMonthYear ge lag(SpanEnds) and
xdate.month(ServiceMonthYear) ne 12

SpanEnds=date.moyr((xdate.month(ServiceMonthYear)+5),xdate.year(ServiceM
onthYear)).
if span eq 0 and ServiceMonthYear ge lag(SpanEnds) and
xdate.month(ServiceMonthYear) eq 12
        SpanEnds=date.moyr(5,ServiceYear+1).
if span eq 0 and (ServiceMonthYear ge SpanBegins) and (ServiceMonthYear
le SpanEnds) Span=lag(Span)+1.
end loop.

I get the following error messages until I get the mxwarns message.

>Warning # 613
>One of the arguments to the DATE function is out of range or is not an
>integer.  The result has been set to the system-missing value.
>Command line: 105  Current case: 5  Current splitfile group: 1

I'm currently using version 17.0.2.

Thanks
Jeff



This e-mail message, including any attachments, is for the sole use of
the intended recipient(s) and may contain private, confidential, and/or
privileged information. Any unauthorized review, use, disclosure, or
distribution is prohibited. If you are not the intended recipient,
employee, or agent responsible for delivering this message, please
contact the sender by reply e-mail and destroy all copies of the
original e-mail message.

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

This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain private, confidential, and/or privileged information. Any unauthorized review, use, disclosure, or distribution is prohibited. If you are not the intended recipient, employee, or agent responsible for delivering this message, please contact the sender by reply e-mail and destroy all copies of the original e-mail message.

=====================
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: Propensity Score Matching vs Risk Adjustment

Anton-24
In reply to this post by Allen Frommelt
Allen-

You may want to look into computing the inverse probability of treatment
weights (IPTW).  This gets around one-to-one matching.

Anton


On Thu, 6 Aug 2009 10:15:52 -0500, Allen Frommelt
<[hidden email]> wrote:

>I am interested in conducting a propensity score matched study, but for a
few of our conditions of interest, the pool of candidates for matching
doesn't make it likely that I will be able to find matches for everyone.
Would risk adjusting provide most of the same effect?  I plan on using
logistic regression to determine the likelihood of the outcomes of interest.
>
>Thanks,
>
>Allen

=====================
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: Adding Months to a Date w Loop

JEFFREY CANTER
In reply to this post by Maguin, Eugene
Gene/Matt,

I agree, datesum is the way to go. I did some testing with your code and then incorporated it in to mine.  Here is what I ended up with to create a six month span and to deal with multiple spans.

match files file *
        /by RecipientID  PaytoProvID
        /first=span.
exe.

if span eq 1 SpanBegins=ServiceMonthYear.
if span eq 1 SpanEnds=DATESUM(servicedate,5,"months","closest").
formats SpanBegins SpanEnds (moyr10).
exe.

loop if (span eq 0).
if span eq 0 and (ServiceMonthYear ge lag(SpanBegins)) and (ServiceMonthYear le lag(SpanEnds)) SpanBegins=lag(SpanBegins).
if span eq 0 and (ServiceMonthYear ge lag(SpanBegins)) and (ServiceMonthYear le lag(SpanEnds)) SpanEnds=lag(SpanEnds).
if span eq 0 and (ServiceMonthYear ge lag(SpanBegins)) and (ServiceMonthYear le lag(SpanEnds)) Span=lag(Span).
if span eq 0 and (ServiceMonthYear ge lag(SpanBegins)) and (ServiceMonthYear ge lag(SpanEnds)) SpanBegins=ServiceMonthYear.
if span eq 0 and ServiceMonthYear ge lag(SpanEnds) SpanEnds=DATESUM(servicedate,5,"months","closest").
if span eq 0 and (ServiceMonthYear ge SpanBegins) and (ServiceMonthYear le SpanEnds) Span=lag(Span)+1.
end loop.
formats SpanBegins SpanEnds (moyr10).
exe.

I'm curious if this code can be improved.  Could it be more efficient/shorter?

Thanks for the help. I wasn't aware of the datesum function but I'll be using it a lot for the type of work I'm doing now.

Jeff


>>> Gene Maguin <[hidden email]> 8/6/2009 11:49 AM >>>
Jeff,

Matt is right that the datesum function is the thing to use here.

Based on your example data, the code I'd use would be (beginning following
the match files command).

Do if (span eq 1).
+  compute spanbegins=servicedate.
+  compute spanends=DATESUM(servicedate,5,"months","closest").
Else.
+  compute spanbegins=lag(spanbegins).
+  compute spanends=lag(spanends).
End if.
Format spanbegins spanends(moyr7).


Gene Maguin

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


This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain private, confidential, and/or privileged information. Any unauthorized review, use, disclosure, or distribution is prohibited. If you are not the intended recipient, employee, or agent responsible for delivering this message, please contact the sender by reply e-mail and destroy all copies of the original e-mail message.

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