Hello all,
I was trying learn frames and put myself to setting up collection of several chi-square test p-values into a new frame. I am running into issues with exporting the variable labels. Can you point me to where the error is occuring? Spaces in variable labels seem to make the code break. Even a pointer to the appropriate help section would be great. See -dataex- and my code.
What I tried:
I was trying learn frames and put myself to setting up collection of several chi-square test p-values into a new frame. I am running into issues with exporting the variable labels. Can you point me to where the error is occuring? Spaces in variable labels seem to make the code break. Even a pointer to the appropriate help section would be great. See -dataex- and my code.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte(age70 anymds mvaf25 hit) str3 ptxrls1 1 1 1 0 "" 1 0 1 0 "" 1 0 0 1 "" 1 0 1 0 "" 0 0 1 0 "" 0 0 1 0 "" 1 1 1 0 "" 1 0 1 0 "" 0 0 1 0 "" 0 0 1 1 "" 1 0 1 0 "" 0 0 1 0 "" 0 0 0 0 "" 1 0 1 0 "" 1 0 0 0 "" 0 0 1 0 "" 0 0 1 0 "" 1 0 0 0 "" 0 0 0 0 "Yes" 0 0 1 1 "" 0 0 0 0 "Yes" 0 0 1 0 "" 1 0 1 0 "Yes" 1 0 1 0 "No" 0 0 1 1 "Yes" 0 0 1 0 "Yes" 1 0 1 0 "" 0 0 1 0 "No" 0 0 1 0 "" 0 0 0 0 "" 0 1 0 0 "Yes" 1 0 1 1 "" 0 0 1 0 "" 1 0 1 0 "" 0 0 0 0 "" 0 1 1 0 "Yes" 1 1 1 1 "" 0 0 0 0 "Yes" 1 0 1 1 "" 0 0 1 0 "" 0 0 1 0 "" 0 0 0 0 "Yes" 1 0 1 0 "" 0 1 1 0 "" 1 0 1 0 "" 0 0 0 0 "Yes" 0 0 1 1 "" 0 0 1 0 "Yes" 0 1 1 0 "" 1 0 1 0 "" 1 0 1 0 "" 0 0 1 0 "" 0 0 1 0 "Yes" 0 0 0 0 "" 1 0 0 1 "" 0 1 1 0 "Yes" 0 0 1 1 "" 1 0 1 0 "" 1 0 1 1 "" 1 1 1 0 "" 0 0 1 0 "" 1 0 1 0 "" 1 0 1 0 "" 0 1 1 0 "" 0 0 1 0 "" 1 0 1 0 "" 1 0 1 0 "" 1 0 1 0 "" 0 0 1 0 "Yes" 0 0 1 0 "" 1 0 1 0 "" 0 0 1 0 "" 0 1 1 1 "" 0 0 0 0 "" 1 0 0 0 "" 1 0 0 0 "" 1 1 0 0 "" 1 0 0 0 "" 1 0 0 0 "" 0 0 0 0 "" 0 0 0 0 "" 1 0 0 0 "" 0 0 1 1 "" 0 0 1 1 "" 1 1 1 0 "" 0 0 0 0 "" 0 0 0 0 "" 1 0 0 0 "" 0 0 1 1 "" 0 0 1 0 "" 0 0 1 1 "" 1 0 0 1 "" 0 0 1 0 "" 0 0 1 0 "No" 0 0 0 1 "No" 0 0 1 0 "" 0 0 1 1 "" 0 0 1 0 "" 1 1 1 0 "" 1 0 1 0 "" end label values age70 age70lab label def age70lab 0 "≤ 70 yrs.", modify label def age70lab 1 "> 70 yrs", modify label values anymds anymdslab label def anymdslab 0 "No", modify label def anymdslab 1 "Yes", modify label values mvaf25 mvaf25 label def mvaf25 0 "≤ 25%", modify label def mvaf25 1 "> 25%", modify label values hit hit label def hit 0 "1 Mutn.", modify label def hit 1 "2+ Mutn.", modify
Code:
frame create chi var chi2 local x age70 anymds mvaf25 hit foreach v of local x{ tab `v' ptxrls1, chi2 return list local `v'lab: variable label `v' frame post chi (``v'lab') (r(p)) } frame change chi frame change default frame drop chi
Comment