Hi everyone,
Hoping to get some advice on how t ocreate a graph for my longitudinal patient panel that would capture how many patients per month (count) belonged to one group (aka on stable dose) versus belonged to another group (medication dose was reduced).
The information on whether the patient is on a stable dose can be derived from the Baseline_begins variable, which is capturing the month in which the patient was on a stable dose.
THe information on the patient whose dose was reduced can be derived from the Month_Followup_begins variable.
I tried running the following code, but pretty sure I messed it up somewhere:
To count N of patients on the baseline per month
Bysort id: egen count_baseline=count(id), by(Baseline_begins)
I tried running the same code with Followup variable, but I am getting identical results:
egen count_followup=count(id), by(Followup_begins)
id Baseline_begins Followup_begins
30 83 86
30 84 87
30 85 88
30 86 89
30 99 102
30 100 103
57 26 29
57 27 30
57 30 33
57 31 34
end
[/CODE]
I would really appreciate any suggestions!
Related Posts with Creating a graph with counts of IDs using 2 different requirements
Issues with a 'Table' command in StataGreetings, I have firm-level panel data for a specific country A. I want to calculate period average…
Interpretation difference in differencesHi all, I know there have been many previous posts about interpreting coefficients of difference in…
CPS employment to unemployment transitionHello stata community, I have been working with static variable of employment and unemployment with…
Counting number of total observation if group contains a certain valueHi everyone, I am working with a scanner household panel and want to count all observations(purchas…
Making n new variables by doing rolling difference of existing variablesHi statalist colleagues, I was struggling with a quite simple thing I guess. Code: foreach v of v…
Subscribe to:
Post Comments (Atom)
0 Response to Creating a graph with counts of IDs using 2 different requirements
Post a Comment