会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
myrj
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
51
52
53
54
55
56
57
58
59
···
186
下一页
2023年3月6日
stata:标签与值标签的相关操作
摘要: webuse auto, clear brow isid price isid mpg sample 10 //修改变量名price的标签 label variable price "my price" label variable foreign "Car originz" //删除指定变量tur
阅读全文
posted @ 2023-03-06 10:31 myrj
阅读(4361)
评论(0)
推荐(0)
2023年3月5日
C语言:最大公约数和最小公倍数
摘要: #include <stdio.h> //求任意两个数的最小公倍数 main() { int a,b,i; scanf("%d%d",&a,&b); for(i=a;i<=a*b;i++) if(i%a==0 && i%b==0) { printf("%d %d的最小公倍数为:%d\n",a,b,i
阅读全文
posted @ 2023-03-05 20:35 myrj
阅读(258)
评论(0)
推荐(0)
stata:删除字符串的空格
摘要: //替换所有空格 //下面语句结果为4 disp length(subinstr(" 123 3 "," ","",.)) //itrim(s) 将字符间多于一个空格缩减为一个空格,对首尾空格不起作用 disp length(itrim(" 123 3 ")) 替换变量中的中文符号 replace
阅读全文
posted @ 2023-03-05 19:46 myrj
阅读(2423)
评论(0)
推荐(0)
stata:字符串截取
摘要: //截取make值的第5 6 7三个字符作为新变量avvv的值 gen avvv=substr(make,5,3) order avvv ,after(make) //substr(s,n1,n2) 用法:s为需要提取的字符串,n1表示提取的起始位置,n2表示要提取的字符字符串的长度。如果n1 <
阅读全文
posted @ 2023-03-05 19:06 myrj
阅读(3393)
评论(0)
推荐(0)
STATA:字符型 数值型变量转换
摘要: STATA:字符型 数值型变量转换 //real()将字符转为数字 gen a6=price+real("1") //将变量a6的类型设置为int(原来浮点型) recast int a6 //将变量a6的类型由int转为str tostring a6,replace //将变量a6的类型由str转
阅读全文
posted @ 2023-03-05 18:47 myrj
阅读(7508)
评论(0)
推荐(0)
STATA:取得字符串的第n个单词,也可处理中文,以空格为分界符
摘要: //word函数是以空格为界 //word(s,n) 取得字符串s的第n个单词 // make a1 a2 //make:AMC Concord Concord AMC order a1 a2,after(make) //返回变量make的第2个单词 gen a3=word(make,2) //返回
阅读全文
posted @ 2023-03-05 15:26 myrj
阅读(205)
评论(0)
推荐(0)
STATA每次打开自动记录单独的日志,不覆盖,便于分析错误原因
摘要: STATA每次打开自动记录单独的日志,不覆盖,便于分析错误原因 //将当前相关代码复制到stata安装目录下的profile.do文件中 //每次打开stata自动保存日志不丢失,不覆盖,以打开stata时日期时间为日志文件名,便于分析错误找原因 local wjm=subinstr(subinst
阅读全文
posted @ 2023-03-05 11:12 myrj
阅读(231)
评论(0)
推荐(0)
STATA:条件函数
摘要: cond(ifc, a, b):条件 ifc 为真时,返回 a, 否则返回 b inrange(x, a, b):如果变量x取值在a 至b之间时,该变量取 1,反之取 0 inlist(x, a, b, ...):如果变量x取值包含a,b,...等取值时,该变量取 1,反之取 0 clip(x, a
阅读全文
posted @ 2023-03-05 10:50 myrj
阅读(491)
评论(0)
推荐(0)
STATA:字符串处理函数收集
摘要: 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
阅读(498)
评论(0)
推荐(0)
STATA:显示当前日期时间
摘要: 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
阅读(253)
评论(0)
推荐(0)
上一页
1
···
51
52
53
54
55
56
57
58
59
···
186
下一页
公告