Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

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

From |
Matthew Krauchunas <krauchunasms@mymail.vcu.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: AW: Combining two financial reports in the same calendar year |

Date |
Mon, 5 Jul 2010 12:17:04 -0400 |

Sorry for not doing a better job explaining my data. California assigns an id number ( oshpd_fac_no) to each PHYSICAL address in the state. I will use this number to xtset my data once I have all the data cleaned up. It is easy to see when a nursing home has changed ownership because the facility names will be different from one period to the next, but the id number (oshpd_fac_no) will stay the same. Thus, the oshpd_fac_no stays with the physical address. Take the following example: oshpd_fac_no facility_name begin_date end_date year days_in_rep_period 206010774 EVERGREEN CASTRO VALLEY HEALTHCARE 01jan2008 30apr2008 2008 121 206010774 CASTRO VALLEY HEALTHCARE AND REHABILITATION CENTER 01may2008 31dec2008 2008 245 The above is a nursing home which has changed ownership, but still resides at the same location. I do not want to combine the financial report data for these observations because it is in essence two distinct nursing homes due to the change in ownership. However, I have other cases where a nursing home, that has maintained the same ownership, has reported multiple financial periods. For example: oshpd_fac_no facility_name begin_date end_date year days_in_rep_period 206010757 BERKELEY PINES CARE CENTER 01jan2004 07jun2004 2004 159 206010757 BERKELEY PINES CARE CENTER 08jun2004 31dec2004 2004 207 In this case, I need to combine these two financial periods (observations) and make them a single observation. On Mon, Jul 5, 2010 at 12:00 PM, Martin Weiss <martin.weiss1@gmx.de> wrote: > > <> > > I do not think that your data setup is transparent to Statalisters, but > generally you can find out whether a nursing home is only represented once > via > > ************* > use http://www.stata-press.com/data/r11/nlswork.dta > bys idcode: gen byte onlyonce=_N==1 > ta onlyonce > ************* > > > > HTH > Martin > > -----Ursprüngliche Nachricht----- > Von: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Matthew > Krauchunas > Gesendet: Montag, 5. Juli 2010 17:43 > An: statalist@hsphsun2.harvard.edu > Betreff: Re: st: AW: Combining two financial reports in the same calendar > year > > Thank you everyone for responding, but now I have a new wrinkle. Some > of the nursing homes changed ownership and that is the reason some of > them have multiple financial reports in a given year. I do not want > to drop these observations as I need them later, but I want to exclude > them from my collapse commands. > > I have used the following code suggested and I have found out the following: > > (1) > sort oshpd_fac_no year,stable > br oshpd_fac_no year facility_name if (oshpd_fac_no== > oshpd_fac_no[_n-1]| oshpd_fac_no==oshpd_fac_no[_n+1]) & > (year==year[_n-1]|year==year [_n+1]) > > - This returns 460 observations, but not all of them are for nursing > homes that have more than one financial period in a calendar year > (i.e., some facilities with only one financial report are included in > the list). > > (2) > I manually cut and pasted one nursing home's two financial reports (in > a single calendar year) into another opened version of Stata. I then > ran the following command: > collapse (rawsum) snf_medcare_days - total_op_rev (mean) > lic_bed_month_avg [aweight= days_in_rep_period] , by( oshpd_fac_no > year) > > - I have checked the results and it has worked correctly. > > My problem now is how do I "keep" only the observations where the > names match and there are more than one financial report per calendar > year? Second, how do I get the collapse results back into the master > data (i.e., how do I replace the 2 financial reports with my new > "collapse" results?) > > Thank you, > Matt > > > > > > > On Sun, Jul 4, 2010 at 9:27 AM, Martin Weiss <martin.weiss1@gmx.de> wrote: >> >> <> >> >> The point that Stata likes data to be in long form remains valid, though, >> and -tsset-ing when really you have panel data wastes a lot of useful >> information unnecessarily. So the fact that -reshape-ing is technically >> possible does not mean that Matthew is better off with the resulting >> dataset... >> >> >> >> HTH >> Martin >> >> >> -----Ursprüngliche Nachricht----- >> Von: owner-statalist@hsphsun2.harvard.edu >> [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Abhimanyu > Arora >> Gesendet: Sonntag, 4. Juli 2010 15:23 >> An: statalist@hsphsun2.harvard.edu >> Betreff: Re: st: AW: Combining two financial reports in the same calendar >> year >> >> Thanks to Martin Weiss, here is a simplified solution for you >> >> >> ************* >> clear >> input var1 var2 >> 1 5 >> 1 3 >> 2 6 >> 2 4 >> end >> >> bys var1:gen var3=_n >> reshape wide var2, i(var1) j(var3) >> >> list, noo >> ************* >> >> On Sun, Jul 4, 2010 at 3:07 PM, Martin Weiss <martin.weiss1@gmx.de> wrote: >>> >>> <> >>> >>> BTW, if you are enamoured of -tsset-, use its second syntax >>> >>> "tsset panelvar timevar [, options]" >>> >>> which is equivalent to -xtset-ting. >>> >>> >>> >>> >>> HTH >>> Martin >>> >>> >>> -----Ursprüngliche Nachricht----- >>> Von: owner-statalist@hsphsun2.harvard.edu >>> [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Martin Weiss >>> Gesendet: Sonntag, 4. Juli 2010 14:39 >>> An: statalist@hsphsun2.harvard.edu >>> Betreff: AW: st: AW: Combining two financial reports in the same calendar >>> year >>> >>> >>> <> >>> >>> Not a problem. Leave the data as "long", and -xtset- "generic": >>> >>> >>> ************* >>> clear* >>> set obs 230 >>> gen int nurshome=_n >>> expand 2 >>> bys nurshome: gen byte observation=_n >>> xtset nurshome observation, generic >>> xtdes >>> ************* >>> >>> Or if the reports are issued half-yearly, change the option to -xtset- >>> appropriately, to -halfyearly-. >>> >>> >>> HTH >>> Martin >>> >>> >>> -----Ursprüngliche Nachricht----- >>> Von: owner-statalist@hsphsun2.harvard.edu >>> [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Matthew >>> Krauchunas >>> Gesendet: Sonntag, 4. Juli 2010 14:30 >>> An: statalist@hsphsun2.harvard.edu >>> Betreff: Re: st: AW: Combining two financial reports in the same calendar >>> year >>> >>> It is indeed panel data, but it will not let me xtset the data by year >>> because I have 230 nursing homes that have 2 financial reports in a >>> given calendar year. Thus, my challenge is to combine these financial >>> reports into 1 observation which is the crux of my problem. >>> >>> Thanks, >>> Matt >>> >>> On Sun, Jul 4, 2010 at 8:18 AM, Martin Weiss <martin.weiss1@gmx.de> > wrote: >>>> >>>> <> >>>> >>>> This sounds like a textbook description of panel data to me, which you >>>> should -xtset-. >>>> >>>> >>>> >>>> HTH >>>> Martin >>>> >>>> >>>> -----Ursprüngliche Nachricht----- >>>> Von: owner-statalist@hsphsun2.harvard.edu >>>> [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Matthew >>>> Krauchunas >>>> Gesendet: Sonntag, 4. Juli 2010 14:10 >>>> An: statalist@hsphsun2.harvard.edu >>>> Betreff: Re: st: AW: Combining two financial reports in the same > calendar >>>> year >>>> >>>> Hi, >>>> >>>> Thank you for your quick reply. No, I need it to stay in long format. >>>> I have about 200 nursing homes that have more than one financial >>>> report for a given calendar year. These are all in the same file. I >>>> need to combine these into one >>>> observation or I cannot tsset the data. >>>> >>>> Thanks, >>>> Matt >>>> >>>> On Sun, Jul 4, 2010 at 7:58 AM, Martin Weiss <martin.weiss1@gmx.de> >> wrote: >>>>> >>>>> <> >>>>> >>>>> Look at >>>>> >>>>> ************* >>>>> help reshape_example >>>>> ************* >>>>> >>>>> to see the two formats available to you. Stata likes long format > better, >>>> but >>>>> it also depends on what you want to do with the data down the road. >>>>> >>>>> Where do these observations reside? If in different files, you could >>>>> -merge-. >>>>> >>>>> >>>>> HTH >>>>> Martin >>>>> >>>>> -----Ursprüngliche Nachricht----- >>>>> Von: owner-statalist@hsphsun2.harvard.edu >>>>> [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Matthew >>>>> Krauchunas >>>>> Gesendet: Sonntag, 4. Juli 2010 13:40 >>>>> An: statalist@hsphsun2.harvard.edu >>>>> Betreff: st: Combining two financial reports in the same calendar year >>>>> >>>>> Hello, >>>>> >>>>> I am working with California nursing home data and I have a number of >>>>> nursing homes that have numerous financial reports in the same >>>>> calendar year that I need to combine. For instance, nursing home ABC >>>>> has one financial report covering period Jan 1, 2004 - Mar 31, 2004 >>>>> and another Apr 1, 2004 - Dec 31, 2004. Is there a way in Stata to >>>>> combine these two "observations" into a single observation? >>>>> >>>>> Thank you, >>>>> Matt >>>>> * >>>>> * 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/ >>>> >>> >>> * >>> * 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/ >> >> >> * >> * 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: Combining two financial reports in the same calendar year***From:*Matthew Krauchunas <krauchunasms@mymail.vcu.edu>

**Re: st: AW: Combining two financial reports in the same calendar year***From:*Matthew Krauchunas <krauchunasms@mymail.vcu.edu>

**Re: st: AW: Combining two financial reports in the same calendar year***From:*Matthew Krauchunas <krauchunasms@mymail.vcu.edu>

**Re: st: AW: Combining two financial reports in the same calendar year***From:*Abhimanyu Arora <abhimanyu.arora1987@gmail.com>

**Re: st: AW: Combining two financial reports in the same calendar year***From:*Matthew Krauchunas <krauchunasms@mymail.vcu.edu>

- Prev by Date:
**RE: st: RE: RE: estimation with a time trend.** - Next by Date:
**Re: st: RE: RE: estimation with a time trend.** - Previous by thread:
**RE: st: AW: Combining two financial reports in the same calendar year** - Next by thread:
**Re: st: AW: Combining two financial reports in the same calendar year** - Index(es):