全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
737 1
2022-11-03
如下图所示
我想批量处理符合条件的城市赋值为1,为什么下面的代码会出错,应该怎么写才是正确的呢?
求大佬解答!!

. gen dxyw=1 if city_xin=="吉林市"|"荆州市"|"周口市"
type mismatch
r(109);

. gen dxyw=1 if city_xin=="吉林市"
(1,268,591 missing values generated)

. replace dxyw=1 if city_xin=="荆州市"
(1,966 real changes made)

. replace dxyw=1 if city_xin=="周口市"|"清远市"|"桂林市"|"连云港市"|"绵阳市"
type mismatch
r(109);



二维码

扫码加我 拉你入群

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

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

全部回复
2022-11-5 11:46:48
先看帮助把基本语法写对
要按照软件的规则

试试下面的

replace dxyw=1 if city_xin=="周口市"|city_xin=="清远市"|city_xin=="桂林市"|city_xin=="连云港市"|city_xin=="绵阳市"
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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