整型
- byte、int、long
- 长度不同
- 格式:%长度.0g、%长度.0gc(三位分隔)
浮点型
- float、double
- 精度不同
- 格式:%长度.小数位数f
字符型
- str+长度
- 格式:%-18s 靠左列印于屏幕上;若 %18s,则靠右列印;若 %~18s, 则居中列印
format
- 改格式
format make %15s
recast
- 改变量类型
recast int headroom, force
lookfor
- 搜索变量,当变量较多时使用
- 根据变量名和标签搜索
destring
- 将字符变量转换为数值变量
set obs 30 //设置30个观察值
gen string = "10" //生成字符变量string
describe
destring string, gen(x) //将string变为数值变量后复制到int,string仍为字符变量
describe
destring string, replace //将string变为数值变量
describe
destring string, replace ignore(" ") //忽略string中的空格等
tostring
- 将数值变量转换为字符变量
- 用法同destring