help for labone

Label varibles

labone labels the variables (If not specified, varlist defaults to _all) using the contents from the specified rows in the data.
It is useful to save detailed information about variables as their labels when importing files (eg.,xls,csv) into Stata.

Syntax

labone [varlist]
[,options]

nrow(numlist) specify the rows for using their contents to label the variables;if not specified,the first row is used

concat(concat_strings) concatenate the contents from different rows by specified strings; default is to concatenate by blank spaces

nospace do not concatenate by spaces

Examples

1.Import an excel file, put the contents in Row 3 of all variables in their labels:

.import excel using http://www.stats.gov.cn/tjsj/ndsj/2014/zk/html/Z0916E.xls,clear

.labone,nrow(3)

2.Import an excel file, put the contents in Rows 3-4 of variables A, B and C in their labels. The contents from Rows 3 and 4 are concatenated by a blank space:

.import excel using http://www.stats.gov.cn/tjsj/ndsj/2014/zk/html/Z0916E.xls,clear

.labone A B C,nrow(3 4)

3.Import an excel file, put the contents in Lines 3-4 of variables A, B and C in their labels. The contents from Rows 3 and 4 are directly concatenated without spaces:

.import excel using http://www.stats.gov.cn/tjsj/ndsj/2014/zk/html/Z0916E.xls,clear

.labone A B C,nrow(3/4) nospace

4. Import an excel file, put the contents in Rows 5, 3 and 4 of all variables in their labels. The contents from Rows 5, 3 and 4 are concatenated by ":" and a blank space£º

.import excel using http://www.stats.gov.cn/tjsj/ndsj/2014/zk/html/Z0916E.xls,clear

.labone,nrow(5 3 4) concat(:)

5. Import an excel file, put the contents in Rows 5, 3 and 4 of all variables in their labels. The contents from Rows 5, 3 and 4 are concatenated by ":" and "+"£º

.import excel using http://www.stats.gov.cn/tjsj/ndsj/2014/zk/html/Z0916E.xls,clear

.labone,nrow(5 3 4) concat(: +)

Authors

Kerry Du, Center for Economic Research, Shandong University, China.

E-mail: kerrydu@sdu.edu.cn.

Also see

Help: label, rename, renvars (if installed)