Announcement

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

  • #16
    You need to find the 40% of affected variables and then provide a data example based on them.

    Comment


    • #17
      Well, show us one of those 40 % of unaffected variables and provide a data example that represents the problem then. More verbal descriptions and vague speculations won't help here.

      Comment


      • #18
        Originally posted by daniel klein View Post
        Well, show us one of those 40 % of unaffected variables and provide a data example that represents the problem then. More verbal descriptions and vague speculations won't help here.
        Thank you. Here are two such variables:
        Code:
        * Example generated by -dataex-. To install: ssc install dataex
        clear
        input double(is12reasnprx1 is12reasnprx4)
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        1 2
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        1 2
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        2 2
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        2 2
        . .
        . .
        . .
        1 2
        . .
        . .
        1 1
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        . .
        end
        label values is12reasnprx1 is12reasnprx1
        label def is12reasnprx1 1 " 1 Yes", modify
        label def is12reasnprx1 2 " 2 No", modify
        label values is12reasnprx4 is12reasnprx4
        label def is12reasnprx4 1 " 1 Yes", modify
        label def is12reasnprx4 2 " 2 No", modify

        Comment


        • #19
          Code:
          elabel define * (= #) (= ustrregexra(@, "^(\s*\d+\s+)(\w+)", "$2")) , modify
          or, a little more carefully but including extended missing values

          Code:
          elabel define * (= #) (= ustrregexra(@, "^(\s*"+string(#)+"\s+)(\w+)", "$2")) , modify

          The second line of code will only remove numeric prefixes that match the respective numeric values. Here is an example:

          Code:
          . label list
          foo:
                    42 42 foo
                    73 42 bar
                    .z .z foobar
          
          . elabel define * (= #) (= ustrregexra(@, "^(\s*"+string(#)+"\s+)(\w+)", "$2")) , modify
          
          . label list
          foo:
                    42 foo
                    73 42 bar
                    .z foobar
          Last edited by daniel klein; 18 Jun 2024, 12:56.

          Comment

          Working...
          X