I'm trying to add a common term to the existing variable labels of a dataset, "LPI: ", so that the resulting variable labels will be "LPI: overall score", "LPI: logistic score", etc. I'm tried the following code but it does not work. I'm wondering how can I do it.
Code I'm using:
Code:
foreach var of varlist LPI_Overallscore-LPI_Timelinessrank { local label_`var' : variable label `var' } foreach var of varlist LPI_Overallscore-LPI_Timelinessrank { label var `var' "LPI: `label_`var''" }
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str24 Country double(LPI_Overallscore LPI_Logisticsscore) int LPI_Timelinessrank "Afghanistan" 9186 7170 12405 "Albania" 4212 6308 7315 "Algeria" 11260 9406 11576 "Angola" 7907 11300 4283 "Argentina" 6227 6566 10093 "Armenia" 4369 12871 7796 "Australia" 4928 5747 8666 "Austria" 5099 13417 11050 "Bahamas, The" 13474 7303 9469 "Bahrain" 9506 9930 7859 "Bangladesh" 4749 12718 7808 "Belarus" 6016 9713 7489 "Belgium" 12245 11021 10706 "Benin" 12157 10801 12278 "Bhutan" 8771 9204 11221 "Bolivia" 10336 8473 11777 "Bosnia and Herzegovina" 4954 6545 5650 "Brazil" 6638 7481 13056 "Brunei Darussalam" 7021 9103 5630 "Bulgaria" 12663 7700 11469 "Burkina Faso" 4944 4149 13905 "Burundi" 5130 7986 11335 "Cambodia" 7431 6137 11752 "Cameroon" 5831 7316 10754 "Canada" 8562 13118 8890 "Central African Republic" 13616 13995 8591 "Chad" 8237 13833 7844 "Chile" 5464 10696 5704 "China" 9355 9124 6747 "Colombia" 11324 7574 8982 "Comoros" 4871 5701 8990 "Congo, Dem. Rep." 9474 7221 12145 "Congo, Rep." 6801 12011 13464 "Costa Rica" 4905 6972 9840 "Croatia" 7114 11478 6692 end label var LPI_Overallscore "overall score" label var LPI_Logisticsscore "logistic score" label var LPI_Timelinessrank "timeliness rank"
Many thanks,
Criag
0 Response to Add common term to a list of different variable labels
Post a Comment