If I type help substr, an explanation still appears, but when I run the following: gen hrs_inicio= substr (chorainici, 1,2) Stata gives me a: substr not found. chorainici is a 4 digit string variable, such as 1416, and I need the first two digits in a new variable. Thanks,...
e(sample) (note: file regression_results.dta not found) file regression_results.dta saved . 八、总结 通过以上内容,我们系统地介绍了Stata 程序设计的各个方面: 程序的基本架构和调用:掌握如何定义和调用程序; 局部和全局暂元:灵活控制变量作用范围; 控制语句:实现复杂逻辑控制和循环操作; 返回值:提取 Stata ...
cap g year = substr(Trddt,1,4) cap g year = substr(Month,1,4) cap g year = substr(Idxinfo11,1,4) cap order year *cap order Stkcd qui foreach v of var * { cap destring `v', replace } sca f_temp = "`f'" loc fname = usubinstr(f_temp,".xlsx","",.) compress } di...
(file stk_violation_son_2023.dta not found) file stk_violation_son_2023.dta saved Contains data from stk_violation_son_2023.dta Observations: 4,983 Variables: 14 1 Aug 2024 17:36 --- Variable Storage Display Value name type format label Variable label ---...
4.6 字符运算 . input str15 xx1.. "10*123"2.. "543*21"3.. "12*422"4.. "43532*32134"5.. "4349*1"6.. end.. gen a=strpos(x,"*").. gen b=substr(x,1,a-1).. gen c=substr(x,a+1,.). dis a3. dis b10. dis c123...
(note: file mylong.dta not found) file mylong.dta saved . reshape wide (note: j = 2003 2004) Data long -> wide --- Number of obs. 16 -> 8 Number of variables 5 -> 6 j variable (2 values) year -> (dropped) xij variables...
The operators defined in Stata are given in the table below:Relational Arithmetic Logical(numeric and string)+addition!not>greater than -subtraction|or<less than *multiplication&and>=>or equal /division<=<or equal ^power==equal !=not equal +string concatenation Stata has many mathematical,...
在处理字符型变量时,Stata 中使用频率较高的是substr()、subinstr(),以及用于正则表达式的regexm() 等函数, Stata 提供了丰富的字符串函数,熟悉它们的使用会让字符串清理事半功倍,更详细的内容 help string function 查阅。 在Python 中,也可以较为方便的对文本数据进行清理。熟悉字符串操作和正则表达式会让文本...
请问按照您这个转出来的时候会出现(note: file *.xlsx.dta not found),并且转换出来的dta文件用stata打开也是空的。请问怎么解决?谢谢您! 赞 回复 虚童作者IP属地: 新疆 2019.10.08 20:53 要设定路径,比如你的文件夹为“D:/data”,那么你需要把我的第一行代码改为 cd "D:/data" 回复 添加新评论 智...
so try to disentagngle the two */ /* get var */ local var = substr("`p'",1,`whereq'-1) qui capture confirm numeric var `var' _assert !_rc, msg("`var' does not exist as a (numeric) variable in dataset") rc(198) /* get time token */ local xtime = substr("`p'",`wh...