I am trying to create the variable that indicates whether a patient ever identified as HIV+. I want to use the following code:
egen sero = max(hiv_cat), by(id)
where hiv_cat is hivstatus recoded as a categorical variable. However, I receive the error messages that egen is an unrecognized function and the by option is not allowed. I'm using Stata v. 16 through the RAE. Thank you for your help,
RH