使用generate命令即可,但要用完整格式:
generate newvar[:lblname] =exp [if] [in]
. sysuse auto,clear
(1978 Automobile Data)
. label list
origin:
0 Domestic
1 Foreign
. gen f = foreign
. gen fg:origin = foreign
. list foreign f fg in 1/5
+-------------------------+
| foreign f fg |
|-------------------------|
1. | Domestic 0 Domestic |
2. | Domestic 0 Domestic |
3. | Domestic 0 Domestic |
4. | Domestic 0 Domestic |
5. | Domestic 0 Domestic |
+-------------------------+