Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Charalambos Karagiannakis <karagiannakis.charalambos@ucy.ac.cy> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: How Can I Store a Variable's Label to Label Another Variable? |

Date |
Wed, 24 Oct 2012 12:46:43 +0300 |

Hello. The loop below labels the new variables using the name of the original variables (see line 3). Is there any way to label the new variable using the label (instead of the name) of the original variable? I found the command ‘copydesc’ however that command is used when you want to copy the description of another variable exactly as it is. In my case below the label of the new variable contains a couple of other words as well. local i = 1 foreach X of varlist inflation_r wages_a { generate `X'_1 = `X'/2 label variable `X'_1 `"Half of `X'"' } Since command ‘describe’ gives also the variables’ labels I tried to see (using the ‘return’ command) whether it saves any results. However, is seems like it does not save the labels. Is there any way to label variable `X'_1 as: Half of ‘and then here I would like the label of variable X instead of the name of variable X’? Thanks in advance. Charalampos K. |

**Follow-Ups**:**Re: st: How Can I Store a Variable's Label to Label Another Variable?***From:*Nick Cox <njcoxstata@gmail.com>

- Prev by Date:
**RE: st: Adjusted Prevalence from Logistic models** - Next by Date:
**Re: st: Adjusted Prevalence from Logistic models** - Previous by thread:
**st: Adjusted Prevalence from Logistic models** - Next by thread:
**Re: st: How Can I Store a Variable's Label to Label Another Variable?** - Index(es):