Announcement

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

  • Codebook question and further options in 'wordcb'

    Hi, I thought 'wordcb' was used for creating Microsoft Word formatted codebook.

    However, the generated document only include the existed values (and the frequency etc.) of the dataset. See the snapshot below:

    Click image for larger version

Name:	Screenshot 2023-12-01 at 12.30.35 pm.png
Views:	1
Size:	45.3 KB
ID:	1735708



    Apparently, there're more other types of drugs in the defined value label. As a data dictionary (codebook), should it include all pre-defined labels from all value labels?

    Or, perhaps I'm misinterpreting the purpose of 'wordcb', while my boss is asking me to generate a codebook that include all pre-defined value labels for using as a reference manual (frequency or percentage is not compulsory).


    Thank you.

  • #2
    I would ping Troy Payne here as the author of wordcb (from SSC, as you are asked to explain). If he doesn't respond, I suggest emailing him directly.

    Comment


    • #3
      I thought 'wordcb' was used for creating Microsoft Word formatted codebook.
      Yes, but...

      As a data dictionary (codebook), should it include all pre-defined labels from all value labels?
      No.

      -wordcb- was intended to create a Microsoft Word file that mimics the output from the built-in command -codebook-. -codebook- does not produce what you want either.

      For a little more background, I wrote -wordcb- because I was formatting a lot of ICPSR style codebooks for data archival purposes at the time. I got tired of copying and pasting -codebook- output from the results window into Word, then having to apply formatting. Defined value labels that did not exist in the data were not relevant to my use case. In any event, -wordcb- doesn't do what you want.

      Nick Cox likely knows of better ways of ultimately solving your problem, which is documenting all defined value labels regardless of whether the value label is used by the dataset in memory. I know of the built-in command -uselabel- , which will replace the dataset in memory with all defined value labels (among a few other details). For example:

      Code:
      sysuse auto
      label define origin 2 "Extra, unused label", modify
      uselabel, clear
      From there, there are multiple ways to get the label information into Word, including -putdocx table-.

      Comment


      • #4
        Code:
        . sysuse auto, clear
        (1978 automobile data)
        
        . label dir
        origin
        
        . label li
        origin:
                   0 Domestic
                   1 Foreign
        
        . label def beasts 1 frog 2 toad 3 newt 4 dragon
        
        . label li
        beasts:
                   1 frog
                   2 toad
                   3 newt
                   4 dragon
        origin:
                   0 Domestic
                   1 Foreign
        
        .

        Comment

        Working...
        X