How can one do case-control matching to randomly match cases and controls based on specific criteria (such as sociodemographic matching - age, sex, etc.) in order to improve data quality?
In case-control studies, you can do it in multiple ways. I assume you already know how to get the controls. Imagine, you are performing secondary analysis, you have a dataset with 200 patients, here you have 30 people of SLE (case), and 170 people without SLE ( source of your control), as we all know matching 1 case with '1 to 4' controls provides adequate power, don't match more than 4 controls for 1 case.
First, match 1:1, that is 1 control for 1 case. As sex is almost always binary, you don't have to manipulate this variable. But age is not binary, so you have to determine the age range you would go. For instance, a 20-year-old man could be matched with 18-25-year-old men in your dataset, this way you could get. Create a categorical variable for age by specifying that range. Also, create a binary variable of who are cases and who are controls. Then, export these 60 people from the dataset and can perform your analysis. If you want to get 1:2, the procedure is the same (export 90 people), but whatever you do, prespecify the hypothesis, sample size, and analysis plan in the beginning. Best of luck!
You can also see propensity score matching or inverse proportional treatment weighting but that procedure is a little complex and you need somebody with advanced statistical analysis knowledge to do that.
If you want to match case-control data there are a few ways to do that like- Propensity Score Matching (PSM), Coarsened Exact Matching (CEM) or exact matching. In my personal experience and literature search propensity score matching is a very good option, but required very high statistical knowledge of several distancing and matching methods. You can look "MatchIt (https://www.rdocumentation.org/packages/MatchIt/versions/3.0.2/topics/matchit) R package.
If you want to do an analysis, you can use conditional logistic regression.