Hello,
I would like to extract from a string variable that contains the filenames of files I used to append into Stata (using a loop).
The files contain the results I need to make a forest plot and each file contains results for a different outcome that can be seen after zcrp_ or crp_ and before _maxadj
An example is below.
From this I would like to have a variable containing the outcome so:
In real life there are many more files than in the example
I would like to extract from a string variable that contains the filenames of files I used to append into Stata (using a loop).
The files contain the results I need to make a forest plot and each file contains results for a different outcome that can be seen after zcrp_ or crp_ and before _maxadj
An example is below.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str244 filevar "V:\Analysis\Spencer\STATA\output\mvmetaipd\mvmetaipd_zcrp_prim_outcome_maxadj6_nocohfnf_results.dta" "V:\Analysis\Spencer\STATA\output\mvmetaipd\mvmetaipd_crp_all_stroke_maxadj6_nocohfnf_results.dta" "V:\Analysis\Spencer\STATA\output\mvmetaipd\mvmetaipd_crp_ep1_stri_maxadj6_nocohfnf_results.dta" "V:\Analysis\Spencer\STATA\output\mvmetaipd\mvmetaipd_zcrp_ep1_strh_nf_maxadj7_nocohfnf_results.dta" "V:\Analysis\Spencer\STATA\output\mvmetaipd\mvmetaipd_crp_ep1_stru_nf_maxadj7_nocohfnf_results.dta" end
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str244 filevar str12 outcome "V:\Analysis\Spencer\STATA\output\mvmetaipd\mvmetaipd_zcrp_prim_outcome_maxadj6_nocohfnf_results.dta" "prim_outcome" "V:\Analysis\Spencer\STATA\output\mvmetaipd\mvmetaipd_crp_all_stroke_maxadj6_nocohfnf_results.dta" "all_stroke" "V:\Analysis\Spencer\STATA\output\mvmetaipd\mvmetaipd_crp_ep1_stri_maxadj6_nocohfnf_results.dta" "ep1_stri" "V:\Analysis\Spencer\STATA\output\mvmetaipd\mvmetaipd_zcrp_ep1_strh_nf_maxadj7_nocohfnf_results.dta" "ep1_strh_nf" "V:\Analysis\Spencer\STATA\output\mvmetaipd\mvmetaipd_crp_ep1_stru_nf_maxadj7_nocohfnf_results.dta" "ep1_stru_nf" end
In real life there are many more files than in the example
Comment