搜索
人大经济论坛 附件下载

附件下载

所在主题:
文件名:  flowchart.do.rar
资料下载链接地址: https://bbs.pinggu.org/a-1962598.html
本附件包括:
  • flowchart.do
附件大小:

  1. *******************************************************************************
  2. *******************************************************************************
  3. ***** *****
  4. ***** *****
  5. ***** 在Stata中绘制流程图 *****
  6. ***** *****
  7. ***** *****
  8. ***** *****
  9. *******************************************************************************
  10. *******************************************************************************
复制代码
  1. *Definition of boxes and line styles.
  2. local osmall = ", box margin(small) size(vsmall)"
  3. local omain= ", box margin(small)"
  4. local bc = ", lwidth(medthick) lcolor(black)"
  5. local bca = ", lwidth(medthick) lcolor(black) mlcolor(black) mlwidth(medthick) msize(medlarge)"

  6. *Drawing the graph
  7. twoway/// 1) PCI to draw a box 2) pcarrowi: connecting arrows.
  8. pci 5.2 0 5.2 6 `bc' || pci 5.2 6 0 6 `bc' || pci 0 6 0 0 `bc' || pci 0 0 5.2 0 `bc' ///
  9. || pci 3 1.5 3 4.5 `bc' || pci 1.9 1.5 1.9 4.5 `bc' || pci 0.9 1.5 0.9 4.5 `bc' ///
  10. || pcarrowi 5 3 3.5 3 `bca' ///
  11. || pcarrowi 4.35 3 4.35 3.35 `bca'///
  12. || pcarrowi 3.5 3 3.2 3 `bca'///
  13. || pcarrowi 3 3 2.1 3 `bca'///
  14. || pcarrowi 1.9 3 1.1 3 `bca'///
  15. , /// Text placed using "added text" [ACHTUNG sizes change with content]
  16. text(5 3 "Assessed for eligibility (n= )" `omain') ///
  17. text(4.35 4.5 "Excluded ""(n= )" ///
  18. "Not meeting inclusion criteria " ///
  19. "(n= )" ///
  20. "Declined to participate " ///
  21. "(n= )" ///
  22. "Other reasons""(n= )" `osmall') ///
  23. text(3.5 3 "Randomized (n= )" `omain') ///
  24. text(3.1 3 "Allocation") ///
  25. text(2.5 1.5 "ACTIVE" ///
  26. "Allocated to intervention""(n=)" ///
  27. "Received allocated intervention ""(n=XXX)" ///
  28. "Did not receive allocated intervention " ///
  29. "(give reasons)" ///
  30. "(n= )" `osmall') ///
  31. text(2.5 4.5 "CONTROL" ///
  32. "Allocated to intervention" ///
  33. "(n= )""Received allocated intervention " ///
  34. "(n= )" ///
  35. "Did not receive allocated intervention " ///
  36. "(give reasons)" ///
  37. "(n= )" `osmall') ///
  38. text(2 3 "Follow-Up" ) ///
  39. text(1.5 1.5 "Lost to follow-up" ///
  40. "(give reasons)" ///
  41. "(n= )" ///
  42. "Discontinued intervention " ///
  43. "(give reasons)" ///
  44. "(n= )" `osmall') ///
  45. text(1.5 4.5 "Lost to follow-up" ///
  46. "(give reasons)" ///
  47. "(n= )" ///
  48. "Discontinued intervention " ///
  49. "(give reasons)" ///
  50. " (n= )" `osmall') ///
  51. text(1 3 "Analysis" ) ///
  52. text(0.5 1.5 "Analysed" ///
  53. "(n= )" ///
  54. "Excluded from analysis" ///
  55. "(give reasons)" ///
  56. "(n= )" `osmall') ///
  57. text(0.5 4.5 "Analysed" ///
  58. "(n= )" ///
  59. "Excluded from analysis " ///
  60. "(give reasons)" ///
  61. "(n= )" `osmall') ///
  62. legend(off) ///
  63. xlabel("") ylabel("") xtitle("") ytitle("") ///
  64. plotregion(lcolor(black)) ///
  65. graphregion(lcolor(black)) xscale(range(0 6)) ///
  66. xsize(2) ysize(3) /// A4 aspect ratio
  67. title("Consort Flowchart") ///
  68. note("{bf: Adapted from:} www.consort-statement.org/consort-statement/flow-diagram" ///
  69. , size(tiny))


  70. //graph export "./flowchart.pdf", as(pdf) replace
复制代码


参考自:https://theesspreckelsen.wordpre ... -consort-flowchart/



2)进一步手动修改的思路

除了在Stata Graph Editor中可直接编辑外,还可根据需要将图片保存为wmf格式, 插入图片到word编辑基本形状和修正连接线:(格式--->绘图工具---->编辑形状----->更改形状)

注:上述xsize(2) ysize(3) 2:3 大致为A4纸宽高比

  1. *-以上主要使用text( ,box )/ twoway pci / twowaypcarrowi

  2. //text( ,box )用法举例

  3. sysuse auto.dta,clear
  4. scatter price mpg, text(500 30 "Assessed for eligibility (n= )", box fcolor(blue) color(white))

  5. //twoway pci 用于描线段
  6. twoway pci 2 0 2 6 4 0 4 6 0 2 6 2 0 4 6 4|| ///
  7. scatteri 5 1 3 3, msize(ehuge) ms(X) || ///
  8. scatteri 5 5 1 5, msize(ehuge) ms(Oh) legend(off)
  9. //twowaypcarrowi 用法举例
  10. twoway pcarrowi 0 0 0 1 (3) "3 o'clock" ///
  11. 0 0 1 0 (12) "12 o'clock", ///
  12. aspect(1) headlabel plotregion(margin(vlarge))
复制代码



    熟悉论坛请点击新手指南
下载说明
1、论坛支持迅雷和网际快车等p2p多线程软件下载,请在上面选择下载通道单击右健下载即可。
2、论坛会定期自动批量更新下载地址,所以请不要浪费时间盗链论坛资源,盗链地址会很快失效。
3、本站为非盈利性质的学术交流网站,鼓励和保护原创作品,拒绝未经版权人许可的上传行为。本站如接到版权人发出的合格侵权通知,将积极的采取必要措施;同时,本站也将在技术手段和能力范围内,履行版权保护的注意义务。
(如有侵权,欢迎举报)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

GMT+8, 2025-12-31 09:42