label dir //显示所有值标签对应的变量名 label list //显示所有带有值标签的变量名,并且显示具体的值标签及对应值 label list origin //显示指定带有值标签的变量史,并且显示具体的值标签及对应值 //使用举例: use ce11,clear list // +-------------------------------------------------+ // | make price mpg rep78 headroom | // |-------------------------------------------------| // 1. | AMC Concord 4,099 22 3 2.5 | // 2. | AMC Pacer 4,749 17 3 3.0 | // 3. | AMC Spirit 3,799 22 . 3.0 | // 4. | Buick Century 4,816 20 3 4.5 | // 5. | Buick Electra 7,827 15 4 4.0 | // |-------------------------------------------------| // 6. | Buick LeSabre 5,788 18 3 4.0 | // 7. | Buick Opel 4,453 26 . 3.0 | // 8. | Buick Regal 5,189 20 3 2.0 | // 9. | Buick Riviera 10,372 16 3 3.5 | // 10. | Buick Skylark 4,082 19 3 3.5 | // +-------------------------------------------------+ . des // Contains data from ce11.dta // Observations: 10 1978 automobile data // Variables: 5 6 Apr 2023 18:49 // (_dta has notes) // -------------------------------------------------------------------------------- // Variable Storage Display Value // name type format label Variable label // -------------------------------------------------------------------------------- // make str18 %-18s Make and model // price int %8.0gc Price // mpg int %8.0g Mileage (mpg) // rep78 str1 %9s Repair record 1978 // headroom float %6.1f Headroom (in.) // -------------------------------------------------------------------------------- // Sorted by: // Note: Dataset has changed since last saved. //建立值标签名称为:good,其中3对应为good1 label define good 3 "good1" //对已经存在的值标签增加值:4对应good2 label define good 4 "good2",add //对于已经存在的值标签的指定值进行修改 label define good 4 "good3",modify //为变量rep78添加标签内容为good label variable rep78 "good" //删除变量rep78的标签内容 label variable rep78 //为变量rep78设置对应的标签good label values rep78 good //为变量rep78去掉对应的值标签对应关系 删除对应关系 label values rep78 //删除值标签good(名称及对应的值) label drop good
标签:good,标签,Buick,label,STATA,操作,rep78,对应 From: https://www.cnblogs.com/xkdn/p/17293910.html