Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Rituparna Basu <basur@pamfri.org> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: Tracking & documenting Change |

Date |
Thu, 5 Apr 2012 20:37:30 +0000 |

Thanks Nick it worked! I followed your suggestion of deleting the duplicates which I thought is correct. -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox Sent: Thursday, April 05, 2012 12:18 PM To: statalist@hsphsun2.harvard.edu Subject: Re: st: Tracking & documenting Change What I quoted was copied and pasted from what you typed. Your mix of criteria could lead to a mess. If change from year to year is the criterion, then it would seem best to reduce the data to one record a year before doing anything else. Otherwise coding and analysis will be unnecessarily complicated. Nick On Thu, Apr 5, 2012 at 8:04 PM, Rituparna Basu <basur@pamfri.org> wrote: > Ok, I see what you are saying. The reason I say 'changed from A to B' because the person was 'A' in 04 and then changed to 'B' in 05 but stayed 'B' in 06 (if you see the data). Exact dates would have been more precise but to keep it simpler I am tracking yearly. > > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox > Sent: Thursday, April 05, 2012 11:52 AM > To: statalist@hsphsun2.harvard.edu > Subject: Re: st: Tracking & documenting Change > > You must, or least should, have a variable that tells you the date more exactly. > > Why say > > 1 05 B Changed A-B > 1 05 B Changed A-B > 1 05 B Changed A-B > > and not > > 1 05 B Changed A-B > 1 05 B Stayed B > 1 05 B Stayed B > > Naturally, the results for transitions will depend on what you define as a possible transition. How could it be otherwise? > > On Thu, Apr 5, 2012 at 7:30 PM, Rituparna Basu <basur@pamfri.org> wrote: >> Thank you Nick! >> Here is the rule: The dataset is about healthcare service records....so there are duplicates bc one can have more than one doctor's visit in a given year. Also, Insurance is numeric. Do you think the code will be different bc of the duplicates? >> I will let you know if the code worked. >> >> -----Original Message----- >> From: owner-statalist@hsphsun2.harvard.edu >> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox >> Sent: Thursday, April 05, 2012 11:21 AM >> To: statalist@hsphsun2.harvard.edu >> Subject: Re: st: Tracking & documenting Change >> >> There seems here an indication that -Ins- changes Year to Year, but in that case why the duplicates? Note that the duplicates get in the way of counting transitions. >> >> But I have to take your example literally because you really don't explain the precise rules. >> >> Also, I assume -Ins- is string because you don't specify and it makes the code easier. But if not, then use -decode- first and use the result of that, not the numeric variable with labels. >> >> gen Status = "" >> sort ID Year >> by ID: replace Status = "Stayed" if Year > Year[_n-1] & Ins == >> Ins[_n-1] by ID: replace Status = "Changed" if Year > Year[_n-1] & >> Ins != Ins[_n-1] by ID: replace Status = Status + " " + Ins + " " + >> Ins[_n-1] if >> !missing(Status) >> by ID: replace Status = Status[_n-1] if missing(Status) >> >> Code not tested. >> >> Nick >> >> On Thu, Apr 5, 2012 at 7:05 PM, Rituparna Basu <basur@pamfri.org> wrote: >> >>> I would like to track the change of insurance status of a person from year to year. After tracking, I would like to document them as %'stayed-same' , %'changed from A-B', etc. >>> Here is the sample data: >>> ID Year Insurance Status >>> 1 04 A >>> 1 04 A >>> 1 04 A >>> 1 04 A >>> 1 05 B Changed A-B >>> 1 05 B Changed A-B >>> 1 05 B Changed A-B >>> 1 06 B Stayed B >>> 1 06 B Stayed B >>> 1 06 B Stayed B >>> 2 04 A >>> 2 04 A >>> 2 04 A >>> 2 05 A Stayed A >>> 2 05 A Stayed A >>> 2 05 A Stayed A >>> 2 05 A Stayed A > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: Tracking & documenting Change***From:*Rituparna Basu <basur@pamfri.org>

**Re: st: Tracking & documenting Change***From:*Nick Cox <njcoxstata@gmail.com>

**RE: st: Tracking & documenting Change***From:*Rituparna Basu <basur@pamfri.org>

**Re: st: Tracking & documenting Change***From:*Nick Cox <njcoxstata@gmail.com>

**RE: st: Tracking & documenting Change***From:*Rituparna Basu <basur@pamfri.org>

**Re: st: Tracking & documenting Change***From:*Nick Cox <njcoxstata@gmail.com>

- Prev by Date:
**Re: Re: st: Stata 12 -twoway function, horizontal recast(area)- bug affecting -confunnel-** - Next by Date:
**st: RE: Random slope model in xtmixed** - Previous by thread:
**Re: st: Tracking & documenting Change** - Next by thread:
**Re: Re: st: Stata 12 -twoway function, horizontal recast(area)- bug affecting -confunnel-** - Index(es):