Hi all,

I am trying to create a Table 1 using Medicare claims to compare demographics among people who do and do not have an outcome, acute MI. I am using a file in which there are multiple claims per person. Each person is identified by a ilinkid.

I created a flag using:

egen byte flag = tag(ïlinkid)

I also created two categories of people with and without acute MI. A person who has acute MI is in category hasMI=1, and a person who doesn't is in hasMI=0.

I was wondering if there was any way to use tab along with the demographic category and the flag. For example, I tried: "tab race if hasMI==1, if flag" which does not work. I want my percentages to be based on # people in the cohort, not on the # claims.

I appreciate any help!