网站首页 美食营养 游戏数码 手工爱好 生活家居 健康养生 运动户外 职场理财 情感交际 母婴教育 生活知识 知识问答

stata中各种字符型变量的定义和使用

时间:2026-02-16 09:37:04

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

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

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

stata中各种字符型变量的定义和使用

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

stata中各种字符型变量的定义和使用

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

stata中各种字符型变量的定义和使用

4、定义model变量和modelwhere变量

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

  gen modelwhere =model +"  " + where

stata中各种字符型变量的定义和使用

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

   list make  where  model  modelwhere

stata中各种字符型变量的定义和使用

© 2026 智德知识库
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com