Regression on multiple datasets with a per-dataset variable
I have 10 datasets, each with the same variables (e.g., age and income) but different numbers of observations.
Let us now consider a categorical variable $X$ that can only take values $0$ and $1$ per dataset, meaning that it keeps the same value for all observations. For 5 datasets, $X=0$; for the other 5, $X=1$.
How do I create a regression model for a variable of these datasets (e.g., age) that takes into account this meta-variable $X$?
A simple solution would be to append a new column for $X$ to each dataset, where the same value is repeated for all observations, and then concatenate the datasets. However, I think there are better ways.
Topic regression metadata
Category Data Science