Hello,

I am examining the longitudinal trajectories of various biomarkers, and I would like to standardize the biomarkers at each time point according to a baseline reference norm (formed from young, healthy participants) by sex. Thus far, I used the syntax below. However, the resulting ‘z scores’ are not true z scores as they do not have a mean of 0 and a sd of 1. How can I standardize in this way and obtain true z scores? Any thoughts would be much appreciated.

*generate norm means and standard deviations for females
foreach var of varlist biomarker0 biomarker0 biomarker0 biomarker0 {
sum `var' if age < 45 & gender == 0 & disease0 == 0
return list
gen nm_`var' = r(mean)
gen nsd_`var' = r(sd)
}

*generate norm means and standard deviations for females
foreach var of varlist biomarker0 biomarker0 biomarker0 biomarker0 {
sum `var' if age < 45 & gender == 1 & disease0 == 0
return list
replace nm_`var' = r(mean) if gender == 1
replace nsd_`var' = r(sd) if gender == 1
}

* generate zscores for biomarkers at baseline
foreach var of varlist clean_ biomarker0 biomarker0 biomarker0 biomarker0 {
gen z`var' = (`var'- nm_`var')/nsd_`var'
}

* generate zscores for biomarkers at follow-up 1 and follow-up 2
gen zbiomarker1 = (biomarker1 - nm_biomarker0) / nsd_biomarker0
gen zbiomarker2 = (biomarker2 - nm_biomarker0) / nsd_ biomarker0