Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

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

From |
"Jesper Lindhardsen" <JESLIN01@geh.regionh.dk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: FW: Possible to generate a variable and specifying the label? |

Date |
Thu, 24 Nov 2011 08:51:14 +0100 |

Hi J, I think that would require you to define the label beforehand, which may or may not be feasible. So in essence you only "get rid" of on line, that is, the -label values- statement (at least in 11.2 ....) clear all set obs 10 label define Lab 0 "Zero" g var:Lab=0 BW, Jesper -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of J. J. W. Dear community users, I am fairly new at STATA 12, so the question I ask might be a bit simple and uninteresting for advanced users. I've already tried to look for a solution, however I couldn't find any. The problem is as follows: I would like to generate a variable including specifying the label name (i.e. I would like to generate variable X and at the same time specifying the label name instead of specifying it afterwards). Now I've looked at the following: http://www.stata.com/help.cgi?gen and came to the conclusion that generate [type] newvar[:lblname] =exp [if] [in] is the command I was looking for. I tried the following: gen NewVar:testlblName = X (note: where NewVar is the name of the new variable and testlblName is the label name I wanted to give NewVar; please bear with me that this is useless command, only used for experimenting with STATA 12 as NewVar would be the same as the list of points in X.) Could someone give an example of how to correct do this? Or point my mistake? I am almost certain that this is possible, however I can't seem to get it work. Yours sincerely, J. J. W. * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**st: RE: RE: FW: Possible to generate a variable and specifying the label?***From:*"J. J. W." <bsc.j.j.w@gmail.com>

**References**:**st: FW: Possible to generate a variable and specifying the label?***From:*"J. J. W." <bsc.j.j.w@gmail.com>

- Prev by Date:
**st: stpm2 and interval censoring** - Next by Date:
**re: st: understanding the -asis()- option in -stsplit-** - Previous by thread:
**st: FW: Possible to generate a variable and specifying the label?** - Next by thread:
**st: RE: RE: FW: Possible to generate a variable and specifying the label?** - Index(es):