asdocx: Export from Stata to Word, Excel, LaTeX & HTML Forums asdocx Forum Value labels diassapear when using the sort option

Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • Rune Lomholt
    Participant
    Post count: 19

    Hello

    Value labels disappear when using the sort option together with asdocx tab. The data do get sorted, by there are suddenly no value labels in the exported tabulation. Is there any way you can resolve this?

    Dr. Attaullah Shah
    Keymaster
    Post count: 106

    I have fixed this. The error was caused by the sort function of Mata. Sorting numbers that are stored as string does not work as expected. I had to find an alternative algorithm and now the sort option works on both string and numbers. See the following examples

    asdocx_update
    sysuse census
    
    * The case where labels are string
    asdocx tab region, replace sort
     0 |1                                2             3                               4 
    ----+--------------------------------------------------------------------------------------
      1 |Census region                Freq.       Percent                Cumulative Freq. 
    ----+--------------------------------------------------------------------------------------
      2 |South                           16         32.00                           32.00 
      3 |West                            13         26.00                           58.00 
      4 |N Cntrl                         12         24.00                           82.00 
      5 |NE                               9         18.00                          100.00 
      6 | Total                          50        100.00                                 
    -------------------------------------------------------------------------------------------
    
    * The case where labels are numbers
    sysuse auto, clear
    asdocx tab rep78, replace sort
    
                                     Tabulation of rep78
      0 |1                                2             3                               4 
    ----+--------------------------------------------------------------------------------------
      1 |Repair record 1978           Freq.       Percent                Cumulative Freq. 
    ----+--------------------------------------------------------------------------------------
      2 |3                               30         43.48                           43.48 
      3 |4                               18         26.09                           69.57 
      4 |5                               11         15.94                           85.51 
      5 |2                                8         11.59                           97.10 
      6 |1                                2          2.90                          100.00 
      7 | Total                          69        100.00                                 
    -------------------------------------------------------------------------------------------
    
    Rune Lomholt
    Participant
    Post count: 19

    Thank you so much for the update!

    Rune Lomholt
    Participant
    Post count: 19

    Also, labels are not correct when using the bysort option with sum.

    I have some summated statistics I want to show, sorted on schools: asdocx bysort school_id: sum VARLIST if school_id~=999, detail stat(count mean sd var cv p50 skewness) title() dec(2) tzok c2_dec(0) c7_dec(0) and the resulting value labels for each group is not correct. Can you take a look at this?

    Thank you for reading this post!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.