對 原有的變數 Year,重新編碼 re code , gen 產生一個 新的變數 DurationYrs 來儲存 年段期間分組
2000~2005 設為1
2006~2009 設為2
2010~2022 設為3
.recode Year (2000 / 2005 = 1 )(2006 / 2009 = 2) (2010 / 2022 =3), gen (DurationYrs)
檢視新變數DurationYrs
.summ DurationYrs
.desc DurationYrs
.tabulate DurationYrs
.tabulate DurationYrs, plot
繪製長條圖,依照 DurationYrs。
.histogram DurationYrs
* 繪製長條圖,DurationYrs 分段間斷discrete。
.histogram DurationYrs, discrete
* 繪製長條圖,DurationYrs百分比。
.histogram DurationYrs, percent
.histogram DurationYrs, discrete percent