Hello everyone,

I have just recently started to learn about pseudo-panel data, and I have some questions that I hope you guys can help me with.

So basically, I have repeated cross-sectional data, and I wanted to construct pseudo-panel data by using birth years as cohorts. So the code I used to create the cohorts is
Code:
egen cohort=group(birth_year)
. I am correct with it?

Following the literature, I implemented the means of variables into the regression by constructing:
Code:
bysort cohort t: egen x1mean=mean(x1)
bysort cohort t: egen x2mean=mean(x2)
bysort cohort t: egen ymean=mean(y)
, where t is the time variable, x1 and x2 are continuous independent variables, and y is a dependent variable.

Then I applied a standard panel regression command:
Code:
xtset cohort t
xtreg ymean x1mean x2mean, fe
In this case, I have x1 and x2 are continuous. My question is, how would I cooperate categorical variables (such as gender, race...) in
Code:
xtreg
command?

Please correct me if my codes seem abnormal.

Thank you for your help and stay safe.