Hi,
I have a matched dataset of ~150k patients, with each matched pair consisting of one case and one control. I used ccmatch; cases and controls were matched on patient_id, a string variable unique to each patient. Each matched pair has a unique value for the variable match.
Now I have appended a new file to this dataset. Content from the new file has many (but not all) of the patient_ids in the existing dataset, plus some additional patient_ids (who I will want to discard). Since matching was not done on the new file, the match variable value is missing for all those patient_ids. I want to populate match for the newly-appended patient_ids who are in the existing dataset, i.e., for the matched cases and controls. After that, I will drop the excess patients who came from the new file (i.e., those patients not matched in the original dataset). The excess patients should be easy to identify since at that point, the non-cases and non-controls should all have missing match values and should be the only patients who have missing match values.
My question: how can I populate a unique value for one variable based on the unique value of another variable? Specifically, how can I populate missing match values, based on existing match and patient_id values? I am thinking this may start with a replacement of match if match==., based on patient_id, but am unsure exactly how to write this out.
An example, using match value 5565, is below. First is the case, then the control. In the newly-appended data, patient_ids 12345 and 67890 may be present, but match (and match_id) would be missing.
[ATTACH=CONFIG]temp_19442_1598106134579_812[/ATTACH]
Array
Related Posts with Populate unique value for a variable based on unique value of another variable
Graph bar - Centering one graph when using -by()-Hi everyone, I'm making a graph for a variable with three categories that resembles the following: …
Visualizing the effect of an interaction term in a log-log model (or poisson model with transformed independent variable)Greetings! I am trying to fit a multilevel regression model for 1,208 households nested in neighbor…
bsample result not robust after innocuous data manipulation?Hi Stata users, Currently I found the bsample is not returning robust results after some seemingly …
-gllamm- for dynamic multinomial logit model with random effectsDear all, I am working on household survey panel data (3 waves) to analyse the dynamic between 4 sta…
Metan forest plot x-axis legend insertion - how?Hi all, can anyone help me with this? Trying to label the two sides of the x-axis with "Favours con…
Subscribe to:
Post Comments (Atom)
0 Response to Populate unique value for a variable based on unique value of another variable
Post a Comment