I'm working with crossectional test data with a selection of test results (all continuous variables) in both a patient and healthy control (HC) group. I have made separate variables for the two groups' test results e.g. test1_controls, test1_patients, test2_controls, test2_patients etc. There are 95 patients and 48 healthy controls. I've attached the data for test 1.
In order to compare the patient group to the healthy control group I want to make a new variable for each test with z-scores; generating a new value for each patient comparing them to the mean of the HC group so I can see how far above or below the "normal" data they fall. So if the test 1 z-score for patient number 1 was -2.3 that would mean they were 2.3 standard deviations below the mean of the healthy control group data for that test. What code would you use for this?
I can do a generate a standardized value using egen test1_patients_z = std(test1_patients)
but these standardized values are only based on the mean and SD of the patient group and I haven't been able to find any options that give me the result I need comparing to the healthy control mean.
I tried egen test1_patients_z = std(test1_patients), mean(#) std(#)
with # being manually entered mean and SD of test1_controls (which I got by codebook) but that did not work (it just shifted the whole scale upwards by the HC mean rather than the normal z score mean of 0).
Thanks for your help!
Related Posts with Generating a new variable with standardized values compared to a healthy control group mean and SD (z scores)
Esttab Indicate Option - Not Turning Off (Yes Instead of No)Hi all! I am using Stata 16. I am having an issue with esttab. I am running several regressions, an…
Questions on Stata command terminologyIf my indepvar is agegroup and have been categorized 31 to 40, 41 to 51 60 above 1. What is the su…
Creating LoopHi I have codes for a few states - {3,4,5,6,1} and years -{ 2007,2008} and indexes- {3,5,2,4,5,2,4,…
Extract numbers (with varying lengths) from variable labelHi friends, I now face the following problem: Code: webuse auto,clear lab var make "STATA#1, 90" …
Why the ''observations" in the regressions are not integers?Dear friends, I have run some simple 2sls regressions. Some results show that the observations are n…
Subscribe to:
Post Comments (Atom)
0 Response to Generating a new variable with standardized values compared to a healthy control group mean and SD (z scores)
Post a Comment