全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
1169 2
2022-12-27
原问题如下:

Describe why the following code to create a towway table of the variables Var1 and Var2 under certain conditions(var3 is equal to 5 and var4 is less than 5 ) is wrong.how would you sugesst to correct it?

tab var1 var2 if var3=5 and var4<5

(explain why the command is wrong and then write the correct command)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2023-1-3 14:57:13
可以先使用keep指标直接筛出“var3=5 and var4<5”的条件,gen一个符合条件
gen vu=1 if var3=5
replace vu=1 if var4<5
然后进行tableau
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2023-2-14 15:35:28
单等号是赋值,双等号才是相等。
stata表示且关系不能用and,用&。
正确形式:
tab var1 var2 if var3==5 & var4<5
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群