私は教育統計のための国立センターからIPEDSと呼ばれる教育データセットを使って作業しています。大学では、専攻、学位修了などに基づいて学生を追跡します。Stataの問題は、特定の専攻科目によって得られた学位の合計数を決定しようとしていることです。精度と数
「メジャー」として機能する値を含む変数cipcode
を持っています。私は
tab cipcode if cipcode==14.2501
のような特定のコードを書くときcipcode
は等々14.2501「石油工学、16.0102 『言語学』とあるかもしれない。
それはno observations
を報告します。私の合計を与えるだろう何のコード?
/*Convert Float Variable to String Variable and use Force Replace*/
tostring cipcode, gen(cipcode_str) format(%6.4f) force
replace cipcode_str = reverse(substr(reverse(cipcode_str), indexnot(reverse(cipcode_str), "0"), .))
replace cipcode_str = reverse(substr(reverse(cipcode_str), indexnot(reverse(cipcode_str), "."), .))
/* Created a total variable called total_t1 for total count of all stem majors listed in table 1*/
gen total_t1 = cipcode_str== "14.2501" + "14.3901" + "15.0999" + "40.0601"
スペルはStataです:編集時に修正されました。 –