Hi Statalist,
I have baseline data from a large number of trials on for example mean age and its standard deviation (SD). I would like to calculate pooled SDs, combining the SD from single studies. Every study is a row in my dataset. I have tried it with this command in which I have first defined a program:
program myratio, rclass
version 17
args y x
confirm var `y'
confirm var `x'
tempname ysum yn
total (`y')
scalar `ytotal' = r(total)
return scalar n_`y' = r(N)
total (`x')
scalar `xtotal' = r(total)
return scalar n_`x' = r(N)
return scalar sqrratio = sqrt(`ytotal'/`xtotal')
end
Then I generate two new variables as input for sqrratio:
generate Age_wvar_drug = (n_drug - 1) * (Age_SD_drug * Age_SD_drug)
generate dfdrugs = n_drug - 1
And finally I try to run the program with these two new variables:
myratio Age_wvar_drug dfdrugs
As a result of the last step I only get my total (sum) estimate for Age_wvar_drug after which the command stops and I get the warning:
=invalid name
(r198)
I have tried a couple of things, but with no result. Help would be much appreciated.
Thanx,
Michiel
I have baseline data from a large number of trials on for example mean age and its standard deviation (SD). I would like to calculate pooled SDs, combining the SD from single studies. Every study is a row in my dataset. I have tried it with this command in which I have first defined a program:
program myratio, rclass
version 17
args y x
confirm var `y'
confirm var `x'
tempname ysum yn
total (`y')
scalar `ytotal' = r(total)
return scalar n_`y' = r(N)
total (`x')
scalar `xtotal' = r(total)
return scalar n_`x' = r(N)
return scalar sqrratio = sqrt(`ytotal'/`xtotal')
end
Then I generate two new variables as input for sqrratio:
generate Age_wvar_drug = (n_drug - 1) * (Age_SD_drug * Age_SD_drug)
generate dfdrugs = n_drug - 1
And finally I try to run the program with these two new variables:
myratio Age_wvar_drug dfdrugs
As a result of the last step I only get my total (sum) estimate for Age_wvar_drug after which the command stops and I get the warning:
=invalid name
(r198)
I have tried a couple of things, but with no result. Help would be much appreciated.
Thanx,
Michiel
Comment