Re: [程式] Stata 重複變數的值
※ 引述《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
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):