Re: [程式] Stata 重複變數的值

看板Statistics作者 (一個人)時間9年前 (2015/06/09 06:00), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
※ 引述《SonicJuice (光陰四濺)》之銘言: : 就是將一個原本的變數裡的值,連著重複出現我要的次數。 : [程式範例]: 這用R會容易很多,不過Stata可以用reshape。以下是例子: clear input quart qval 1 120 2 240 3 180 4 210 end forval i=1/3 { gen mval`i'=qval/3 } reshape long mval,i(quart) gen month=_n drop _j qval order quart month mval -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 128.101.83.82 ※ 文章網址: https://www.ptt.cc/bbs/Statistics/M.1433800845.A.C4D.html
文章代碼(AID): #1LTX2DnD (Statistics)
文章代碼(AID): #1LTX2DnD (Statistics)