Hello,
I am new to the Stata community and was hoping for some help with panel data analysis. I have health care data with 'clientid' as the panel variable. However, a client may have multiple visits on the same day with different or missing data recorded on the outcome variable (surveyid provides a unique identifier for observations on the same day). Here is a sample of my dataset:
clientid date medfreq severity surveyid
1 01/02/18 1 4 12345
1 02/21/18 4 12789
1 03/08/18 12890
1 06/15/18 3 2 12990
2 01/02/18 4 12681
2 01/02/18 2 3 12688
2 03/08/18 1 3 13450
2 06/15/18 3 3 13560
I have declared my dataset as panel data without indicating the time variable since there are repeated dates, which I want to preserve. Is this the correct approach?
I want to identify the first and last occurrences that are ≥3 months apart with data recorded on "medfreq." I would then like to run a xtab to see how clients changed over time from their first to last occurrence. I didn't find any literature on this specific issue but would be grateful for any suggested code or if someone can kindly refer me to an existing reference.
Thank you,
Samira
Related Posts with panel data xtabs first and last occurrence
Creating a Dummy variable for every first duplicate observation (using -Duplicates Drop- without deleting duplicate observations)Hey all, I was wondering if there is a formula to create a dummy variable for the first observatio…
What is the syntax to retrieve r-class stored results in multiple equation models, like bivariate poisson, var, or sure?I can retrieve coefficient estimates by: gen Cf = [equationname]_b[varname] ,no problem! But I am ha…
Sequence effect with repeated measuresDear team, I have a crossover design with following repeated data structure: Two methods for measuri…
Replicating fitted values graph Hi all, I am hoping to replicate a graph from this paper in Political Analysis. The graph, attach…
How to Plot a two-way Interaction GraphDear Statalist I'm currently trying to plot a two-way interaction graph. My logit regression code i…
Subscribe to:
Post Comments (Atom)
0 Response to panel data xtabs first and last occurrence
Post a Comment