Bookmark and Share

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]

st: RE: set: expanding data set by variable


From   "George Gunapal Pradeep Paul (NHGHQ)" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE: set: expanding data set by variable
Date   Wed, 9 May 2012 04:59:48 +0000

Hi all,
I am have data on Chronic obstructive pulmonary disease patients who were enrolled in a disease management program and a group of controls. I used psmatch2 to match program patients  and controls patients using a set of covariates. Now I would like to compare the matched cases and controls using the command (matched case control) and also would like to run a cox regression on the matched cases. The MCC option asks me to select the matched cases and controls. Am I missing out on any variables generated after psmatch2 which can identify the matches case and controls? Look forward to your help.

Thank you,
Pradeep

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of KOTa
Sent: Wednesday, May 09, 2012 8:19 AM
To: [email protected]
Subject: Re: st: expanding data set by variable

thanks for quick response, Nick

> 1. What the date variables are (string, numeric, numeric with a date format)?

sorry i just didnt think to mention this, cause it can easily converted among those formats you listed. ( and i actually have dates in all 3 of them)

> 2. Why you think the second data structure is going to be a good one?

what i am trying to do is to count the time spent on each "type" of activity. which i already figured out how to do (with the help from the statalist ) but the problem is if activities overlap in days for same person and i dont take account for this - i over-count them both.
so what i tried to do is to split time equally among requests (ID) that happened at the same time(for same user). i managed to do this for requests (ID) that start at the same time, but could not find a way to do this if they start at different times (and it can be overlap between more then 2 requests). the aprouch i though to take is to recode the data so each observation would be split into not overlapping periods.

> If this were my data, I would get a different structure this way:
> ...
> gen mydate = date(string(start, "%12.0f"), "YMD") gen mydate2 =
> date(string(end, "%12.0f"), "YMD") format mydate %td gen length =
> mydate2 - mydate + 1

that is how i started

> expand length

that what i wanted to do, but could not find in the help or examples if "expand" can be used this way

> bysort ID : replace mydate = mydate + _n - 1

1. i forgot to mention that the count has to be by activity type. so, correct me if i wrong the bysort then should be "bysort ID type" ..."
2. i didn't understand the logic of replace mydate = mydate + _n - 1


thanks again
*
*   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/

---------------------------------------------------------------------------------
The information contained in this e-mail and the attachments (if any) may be privileged and confidential and is intended solely for the named addressee.  If you are not the intended recipient, please do not print, retain copy, disseminate, distribute, or use this e-mail or any part thereof.  Please notify the sender immediately by replying to this e-mail and delete all copies of this e-mail and the attachments.

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index