作者porfu (一個人)
站內Statistics
標題Re: [程式] Stata 重複變數的值
時間Tue Jun 9 06:00:43 2015
※ 引述《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://webptt.com/m.aspx?n=bbs/Statistics/M.1433800845.A.C4D.html