stata中变量的使用

 时间:2026-04-25 12:10:53

1、用list make weight 显示数据

stata中变量的使用

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

stata中变量的使用

3、用replace命令replace weight=weight/1000

stata中变量的使用

4、如果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

stata中变量的使用

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

 步骤4中foreign 显示为domestic和foreign,而步骤5中foreign 显示为0和1

stata中变量的使用

6、gen where ="D" if foreign=="Domestic":origin

   replace where ="F" if foreign=="Foreign":origin

  如果foreign的值为domestic则where的值为D,否则where的值为F

stata中变量的使用

7、显示自定义变量.list make foreign where

stata中变量的使用

8、显示where变量的详细信息

stata中变量的使用

9、定义model变量和modelwhere变量

  gen model =usubstr(make,ustrpos(make,"")+1,.)

  gen modelwhere =model +"  " + where

stata中变量的使用

10、显示model变量和modelwhere变量的值。

   list make  where  model  modelwhere

stata中变量的使用

  • Stata如何导入dta文件?
  • p值大于0.05说明什么
  • stata的历史窗口不见了怎么找回
  • 怎么分辨截尾和拖尾
  • stata入门学习之查看数据文件中变量详细信息
  • 热门搜索
    盐蒸橙子的功效与作用 高中物理知识点 核桃分心木泡水喝的功效与作用 玉屏风颗粒的功效与作用 芦根的作用 山奈的功效与作用 新婚知识 什么叫滑精 生草乌的功效与作用 手表知识