Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Creating variable label text lists by observation

    Hello,

    I am trying to do some topic modeling based on the variable labels contained in firms' balance sheets. I need to produce a basic text list of the variable labels for which an observation (firm-year) has nonzero/nonmissing entries. I have tried modifying the following (which produces a text list of all variable names and labels) in several different ways to no avail.

    foreach var of varlist *{ di "`var'" _col(20) "`: var l `var''" _col(50) "`: val l `var''" }
    Suggestions are much appreciated

  • #2
    This is very unclear. Does "has nonzero/nonmissing entries" mean that some of the entries are neither zero nor missing, or all of the entries are both non-zero and non-missing, or something else? And do I understand correctly that you want a list of the variables satisfying that condition for each combination of firm and year in the data set? What about text variables? They are automatically non-zero, though they can be missing?

    Comment


    • #3
      I don't understand this. A variable label is fixed across observations when it is defined. Also, your loop when displayed more readably

      Code:
      foreach var of varlist * {
          di "`var'" _col(20) "`: var l `var''" _col(50) "`: val l `var''"
      }
      uses syntax for displaying the variable labels and the names of the value labels, neither of which do relate to any specific observations. We can't comment of any of your modifications of that code because you don't say anything about them.

      If you don't get a better answer, I would back up and give us a concrete example of your problem with data, because none of the detail so far makes it clear.

      Comment

      Working...
      X