上一页 1 ··· 46 47 48 49 50 51 52 53 54 ··· 180 下一页
摘要: length("asdf") //检测字符串长度 //*命令 subinstr(S1,S2,S3,n),n表示迭代的次数,S1是变量,S2是需要替代的变量,S3是新替换的变量。如果n是.代表所有的都换*/ //reverse()字符串逆顺 local wjm="`c(current_time)'`c 阅读全文
posted @ 2023-03-05 09:23 myrj 阅读(186) 评论(0) 推荐(0) 编辑
摘要: display "`c(current_time)' `c(current_date)'" local wjm="`c(current_time)'`c(current_date)'" wjm=subintstr(local wjm,":","",2) disp local wjm 阅读全文
posted @ 2023-03-05 06:21 myrj 阅读(173) 评论(0) 推荐(0) 编辑
摘要: //求余数:mod(_n,2)==0 use auto1, clear replace price=price+10 if mod(_n,2)==0 abs(x) 绝对值 abs(-9)=9 comb(n,k) 从n中取k个的组合 comb(10,2)=45 exp(x) 指数 exp(0)=1 f 阅读全文
posted @ 2023-03-05 05:20 myrj 阅读(262) 评论(0) 推荐(0) 编辑
摘要: webuse auto, clear //写两个命令,先排序,再建立新变量 //根据foreign排序,新生新变量,其值是不同的foreign分别从1开始计数 sort foreign by foreign:gen filter=_n //上面两个命令写成一个命令,功能相同 bys foreign, 阅读全文
posted @ 2023-03-05 05:15 myrj 阅读(41) 评论(0) 推荐(0) 编辑
摘要: import pandas as pd from pandas.io.stata import StataReader, StataWriter file="cfps2020famconf_202301.dta" stata_data = StataReader(file, convert_cate 阅读全文
posted @ 2023-03-04 11:34 myrj 阅读(69) 评论(0) 推荐(0) 编辑
摘要: 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) # 阅读全文
posted @ 2023-03-04 11:15 myrj 阅读(170) 评论(0) 推荐(0) 编辑
摘要: from Crypto.Cipher import PKCS1_v1_5 as PKCS1_cipher ModuleNotFoundError: No module named 'Crypto' 解决方法: pip install pycryptodome 阅读全文
posted @ 2023-03-04 09:15 myrj 阅读(811) 评论(0) 推荐(0) 编辑
摘要: //建立新变量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 阅读全文
posted @ 2023-03-04 08:40 myrj 阅读(218) 评论(0) 推荐(0) 编辑
摘要: sysuse auto,clear //遍历显示所有变量名 foreach v of varlist _all { dis "`v'" } //显示当前记录各个变量的值 foreach v of varlist _all { dis `v' } //ds显示所有变量名,只有变量名 ds foreac 阅读全文
posted @ 2023-03-04 08:38 myrj 阅读(936) 评论(0) 推荐(0) 编辑
摘要: local varsa rep78 headroom trunk weight length turn displacement gear_ratio foreign local nv=10 foreach var of local varsa{ rename `var' `var'`nv' } / 阅读全文
posted @ 2023-03-04 07:27 myrj 阅读(470) 评论(0) 推荐(0) 编辑
上一页 1 ··· 46 47 48 49 50 51 52 53 54 ··· 180 下一页