stata中如何定义虚拟变量
展开全部
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。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |