In Stata, how do I add variable labels from a separate csv file?

荒凉一梦 提交于 2019-12-06 11:19:19

Ideally each line of the metadata is something like

varname1 "more interesting description"

in which case you can prefix each line with

label var 

and then run the file as if it were a do-file using do. See the help for label. That is easy in a decent text editor, as for example searching for the start of each line and replacing it with label var (note the need for the space).

What could bite here includes:

  1. You don't have double quotes " " as delimiters, in which case you need to insert them.

  2. The extra information does not qualify as a variable label because it is more than 80 characters long. See help limits.

There are other ways to do this with Stata. You could write a program to read in the metadata and write out a do-file using file, but if this were my problem I would reach first for my text editor. (Most experienced Stata programmers use something else as well as doedit.)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!