摘要:
import pandas as pd from pandas.io.stata import StataReader, StataWriter file="cfps2020famconf_202301.dta" stata_data = StataReader(file, convert_cate 阅读全文
摘要:
import pandas as pd data = pd.read_stata('cfps2020famconf_202301.dta') data.to_stata('output_file.dta') data.to_stata('output_file.dta', version=12) # 阅读全文
摘要:
from Crypto.Cipher import PKCS1_v1_5 as PKCS1_cipher ModuleNotFoundError: No module named 'Crypto' 解决方法: pip install pycryptodome 阅读全文
摘要:
//建立新变量vv,其值:trunk只能为11或17,mpg可以从18-30间时为1,其他为0 gen vv=inlist(trunk,11,17)&inrange(mpg,18,30) //建立新变量vva,其值:trunk为11-17,mpg可以从18-30间时为1,其他为0 gen vva=i 阅读全文
摘要:
sysuse auto,clear //遍历显示所有变量名 foreach v of varlist _all { dis "`v'" } //显示当前记录各个变量的值 foreach v of varlist _all { dis `v' } //ds显示所有变量名,只有变量名 ds foreac 阅读全文
摘要:
local varsa rep78 headroom trunk weight length turn displacement gear_ratio foreign local nv=10 foreach var of local varsa{ rename `var' `var'`nv' } / 阅读全文