stata中如何定义虚拟变量

 我来答
求真实验室
2022-10-13 · 探索生活中的科学奥秘
求真实验室
太平洋电脑网是专业IT门户网站,为用户和经销商提供IT资讯和行情报价,涉及电脑,手机,数码产品,软件等。
向TA提问
展开全部

1、用list make weight 显示数据。

2、尝试执行 gen weight=weight/1000,系统提示变量已存在。

3、如果foreign==0,将price提高5%,如果foreign==1,将price提高10%。   gen predprice=1.05*price if foreign==0 和replace predprice=1.1*price if foreign==1   再显示结果list make foreign price predprice。

4、list中nolabel参数的使用。list make foreign price predprice,nobel。

5、gen where ="D" if foreign=="Domestic":origin replace where ="F" if foreign=="Foreign":origin如果foreign的值为domestic则where的值为D,否则where的值为F。

推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式