Using Stata for Survey Data Analysis
Download 1.39 Mb. Pdf ko'rish
|
2009 Usingstataforsurveydataanalysis (1)
label define lblname # "label" # "label" # “label” [, add modify]
Using Stata for Survey Data Analysis Minot Page 29 where lblname is the name given to the set of value labels # are the value numbers “label” are the value labels add means that you want to add these value labels to the existing set modify means that you want to change these values in the existing set Note that: You can use the abbreviation “lab def” The double quotation marks are only necessary if there are spaces in the labels Stata will not let you define an existing label unless you say “modify” or “add” This command is similar to “value label” in SPSS except that in Stata you give the labels a name and later attach it to the variable, while in SPSS you attach it to the variable in the same command. label values This command attaches named set of value labels to a categorical variable. The syntax is: label values varname lblname where varname is the categorical variable which will get the labels lblname is a set of labels that have already been defined by label define Here are some examples of labeling values in Stata. label variable yield "Yield (tons/hectare)" gives label to variable yield label define yesno 0 no 1 yes defines set of labels called yesno label values electricity yesno attaches labels to the variable “electricity” label define yesno 3 "perhaps", add adds new value label to existing set label define yesno 3 "maybe", modify modifies existing value label label define reglbl 1 West 2 Center 3 East defines regional labels label values region reglbl attaches regional labels to region label define reglbl 2 Central, modify modifies regional labels Some additional commands that may be useful in labeling label dir to request a list of existing label names label list to request a list of all the existing value labels label drop to delete a one or more labels label save using to save label definitions as a Do-file label data to give a label to a data file More information is available by typing “help label” in the Stata Command window. Example 13 shows a frequency table with and without labels. The first table has no labels. Then, the “label var” command is used to give the “region” a label of “Region of Bhutan”. Next, the “label define” command creates a label for each region and label values attaches those labels to the “reigon” variable. The second table has both the variable label (in the upper left corner of the table) and the labels for each regions. |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling