I would like to write the output of a nested -foreach- loop to a .txt
file with the -file- command, and am having some difficulty doing so
successfully.
My dataset consists of patients with length of chemotherapy courses and
variables for gender, race, and treatment, all of which are binary
variables. I would like to be able to compare length of chemotherapy
course by sex, race, and treatment and output the mean, sd, and p value
for each comparison.
I would appreciate help in using the -file- command to output these
values to a .txt file.
My code is as follows:
local variables "sex race treatment"
local courses "course100 course200 course300 course701 course702
course703..."
foreach course of local courses {
foreach variable of local variables {
ttest `course', by(`variable')
}
}
Thanks in advance for the help and my apologies for not being able to
figure this out on my own.
Richard
--
Richard Aplenc, MD
Pediatric Oncology/Stem Cell Transplant
Children's Hospital of Philadelphia
Center for Clinical Epidemiology and Biostatistics
University of Pennsylvania
215-573-0259 (lab)
215-590-4183 (fax) [email protected]