Announcement

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

  • Asdoc error in tabulation with Freq=1

    Hi all,

    (apologies for my mistake in subject, i tried to fix but its not possible: Freq=1 mean r(r) = 1 or percent=100 )

    I am having problems with asdoc when r(r) = 1 or percent=100. I know that sound a naive question but I am running a loop cycle with 3 way cross tabulation in a big number of variables and found this issue.
    an example is:

    set obs 100
    gen var=1
    tab var

    Code:
            var |      Freq.     Percent        Cum.
    ------------+-----------------------------------
              1 |        100      100.00      100.00
    ------------+-----------------------------------
          Total |        100      100.00
    
    
    . ret li
    
    scalars:
                      r(N) =  100
                      r(r) =  1
    with asdoc
    Code:
    asdoc tab var
    
    
            var |      Freq.     Percent        Cum.
    ------------+-----------------------------------
              1 |        100      100.00      100.00
    ------------+-----------------------------------
          Total |        100      100.00
                 tabonevar():  3200  conformability error
                     <istmt>:     -  function returned error
    r(3200);

    Please any comment i would grateful
    Rodrigo
    Last edited by Rodrigo Badilla; 24 Nov 2018, 11:38.

  • #2
    I just want to give credit to Attaullah Shah who has written asdoc (from ssc).

    Comment


    • #3
      (Of couse asdoc its great! make my work more easy!)

      As I mentioned earlier my goal is make multiple cross tables...

      I fix the error when r(r) = 1. The solution its no so elegant but work.

      Code:
      sysuse auto, clear
      gen var= 1
      set more off
      foreach y of varlist foreign var  make {
      tab `y'  
      if `r(r)' ==1  {
       asdoc, text(\b Error in frequency table for `y'   ... :(  )
      }
       else  {
       asdoc tab `y'  
      }
      }
      it give a word doc with:

      Tabulation of foreign
      Domestic 52 70.27 70.27
      Foreign 22 29.73 100.00
      Total 74 100.00

      Error in frequency table for var...



      Tabulation of make
      > Cum.
      > -------
      AMC Concord 1 1.35
      > 1.35
      AMC Pacer 1 1.35
      > 2.70
      AMC Spirit 1 1.35
      > 4.05
      Audi 5000 1 1.35

      Comment


      • #4
        Rebecca Water Thanks for your kind words.

        Rodrigo Badilla yes, it seems to be a bug which I shall fix in a week or so.
        Regards
        --------------------------------------------------
        Attaullah Shah, PhD.
        Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
        FinTechProfessor.com
        https://asdocx.com
        Check out my asdoc program, which sends outputs to MS Word.
        For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

        Comment


        • #5
          Attaullah Shah Thanks for great effort! Regards!

          Comment

          Working...
          X