Announcement

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

  • labmask (SSC) may not label 5030000000

    Dear Nick Cox , I encounter an unintuitive error which -labmask- (SSC). Do you have an idea what happens there?

    -labmask- works well for a few hundret values but it stops at one case.

    My code is as follows:
    Code:
    labmask aobj_vorg, val(projekttitel1) lblname(l_aobj)
    The unique number of aobj_vorg is 1.054 and the unique number of projekttitel1 is 1.039.

    Tracing the error shows the following sequence at the end:


    Code:
     su `example' if `group' == `i', meanonly
    = su __000005 if __000004 == 1053, meanonly
    - local label = `values'[`r(min)']
    = local label = projekttitel1[1082]
    - local value = `varlist'[`r(min)']
    = local value = aobj_vorg[1082]
    - label def `lblname' `value' `"`label'"', modify
    = label def l_aobj 5003000000 `"CEDUS"', modify
      --------------------------------------------------------------------------------------------------------------------------------------------------------------- begin label ---
      - version 10.0
      - local vv : display "version " string(_caller()) ", missing:"
      - gettoken val : 0
      - if (strpos("`val'", "val") > 0 ) {
      = if (strpos("def", "val") > 0 ) {
        gettoken val 0 : 0
        syntax anything [, nofix]
        if "`fix'" != "" {
        local fix ", nofix"
        }
        gettoken var rest : anything
        while `"`rest'"' != "" {
        gettoken lab rest : rest
        local label "`lab'"
        }
        local vlist : list anything - lab
        if "`lab'" == "." {
        local lab ""
        }
        foreach var of varlist `vlist' {
        `vv' _label `val' `var' `lab' `fix'
        }
        }
      - else {
      - `vv' _label `macval(0)'
      = version 7, missing: _label def l_aobj 5003000000 `"CEDUS"', modify
    may not label 5003000000
        }

  • #2
    This isn't specific to labmask. The largest positive integer that you can attach a label to is 2,147,483,621, which is - for some reason - one more than the documented largest value of a type long variable.

    Comment


    • #3
      Thanks for Marc Kaulisch for the question and daniel klein for the answer. I agree with Daniel, and indeed the trace in #1 shows that label is objecting to the request.

      FYI, labmask if you want to reference it was published via the Stata Journal

      Code:
      . search labmask, sj
      
      Search of official help files, FAQs, Examples, and Stata Journals
      
      SJ-8-2  gr0034  . . . . . . . . . .  Speaking Stata: Between tables and graphs
              (help labmask, seqvar if installed) . . . . . . . . . . . .  N. J. Cox
              Q2/08   SJ 8(2):269--289
              outlines techniques for producing table-like graphs
      although the code on SSC is idnntical, namely

      Code:
      *! NJC 1.0.0 20 August 2002

      Comment


      • #4
        Thanks to both of you, Nick Cox and daniel klein. I was not aware of this. So I have to find a good way to reduce the 10digit numbers to nine digits without risking duplicate entries...

        Comment


        • #5
          The built-in -egen- function -group()- will create a new variable that is a many to 1 mapping of your variable -aobj_vorg-. There are other ways to get from 10 digits to something smaller and non-duplicating, but that's probably the easiest. The new variable won't necessarily be 9 digits long; it will range from 1 to however big is needed. If that is OK, and presuming that the actual values of -aobj_vorg- aren't of intrinsic interest, the following might work for you.

          Code:
          egen shorter = group(aobj_vorg)
          labmask shorter, val(projekttitel1) lblname(l_aobj)

          Comment


          • #6
            Originally posted by Mike Lacy View Post
            The built-in -egen- function -group()- will create a new variable that is a many to 1 mapping of your variable -aobj_vorg-. There are other ways to get from 10 digits to something smaller and non-duplicating, but that's probably the easiest. The new variable won't necessarily be 9 digits long; it will range from 1 to however big is needed. If that is OK, and presuming that the actual values of -aobj_vorg- aren't of intrinsic interest, the following might work for you.

            Code:
            egen shorter = group(aobj_vorg)
            labmask shorter, val(projekttitel1) lblname(l_aobj)
            Hi Mike Lacy , thanks a lot for this excellent idea. To some degree values of aobj_vorg have an intrinsic interest but labels are good enough to counter the downside.

            Comment

            Working...
            X