Announcement

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

  • asdoc with Chinese label

    Dear All, How can I output the correlation matrix into Word with a "Chinese" label using (ssc install) asdoc? Please see the example
    Code:
    sysuse auto, clear
    label var price "價格"
    label var mpg "重量"
    asdoc cor price mpg, label replace
    The output is
    Click image for larger version

Name:	Chinese label.png
Views:	1
Size:	5.4 KB
ID:	1593085


    Any suggestions are highly appreciated. Thanks.
    Ho-Chuan (River) Huang
    Stata 17.0, MP(4)

  • #2
    Since asdoc uses RTF format, the Unicode characters present a formidable task and in most cases these characters are shown as garbled text. This is one among many other reasons that I wrote asdocx, you can read the differences between asdoc and asdocx here. The example you have shown produces the following output when we use asdocx.

    Code:
    sysuse auto, clear
    label var price "價格"
    label var mpg "重量"
    asdocx cor price mpg, label replace
    Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	11.1 KB
ID:	1593092
    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


    • #3
      Dear Attaullah, Thanks. I have purchased the "asdocx" package. I have a problem as follows (for illustration).
      Code:
      sysuse auto, clear
      
      label var price "汽車價格"
      label var weight "汽車的重量"
      label var length "汽車的長度"
      label var rep78 "維修紀錄"
      label var mpg "每小時里程數"
      label var foreign "車子類型(國內外)"
      label var gear_ratio "齒輪比"
      label var trunk "汽車後面的行李空間"
      label var displacement "車子的排氣量"
      
      global all "price weight length rep78 mpg foreign gear_ratio trunk displacement"
      
      asdocx cor $all, label fs(8) dec(4) save(log\T2-cor.doc) replace
      The output in the Stata Results window is:

      Click image for larger version

Name:	asdocx-0.jpg
Views:	1
Size:	394.7 KB
ID:	1593241


      However, the output in Word is:

      Click image for larger version

Name:	asdocx-1.jpg
Views:	1
Size:	218.6 KB
ID:	1593240


      In my own case, I have more variables than those in the above example. Could you give some suggestions on this? Thanks.
      Ho-Chuan (River) Huang
      Stata 17.0, MP(4)

      Comment


      • #4
        The option for font size fs() was not working correctly. I have fixed that and you can update asdocx with
        Code:
        asdocx_update
        You may also like to use the table_layout(autofit) option to get a tight fit for contents. Here is the output from your code given above.
        Code:
        asdocx cor $all, label fs(8) dec(4) save(T2-cor.doc) replace table_layout(autofit)
        Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	44.2 KB
ID:	1593276
        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
          Dear Attaullah, Thanks a lot for the suggestion. I will give it a try ASAP.

          Ho-Chuan (River) Huang
          Stata 17.0, MP(4)

          Comment


          • #6
            Dear Attaullah, Your command worked quite well. Thanks. However, another problem is the (long) name of the variable as follows.

            Click image for larger version

Name:	long-varname.png
Views:	1
Size:	10.8 KB
ID:	1593391



            Any suggestions?
            Ho-Chuan (River) Huang
            Stata 17.0, MP(4)

            Comment


            • #7
              Dear Attaullah, When I ran
              Code:
              sysuse auto, clear
              asdoc list make price mpg in 1/10, sep(0)
              The output is (in Stata results window)

              Click image for larger version

Name:	list-1.png
Views:	1
Size:	26.1 KB
ID:	1593699



              However, the output in the Myfile.doc is

              Click image for larger version

Name:	list-2.png
Views:	1
Size:	20.9 KB
ID:	1593700


              My question is that, can I make the variable names to be centrally (or left) aligned using asdoc(x)? Thanks.
              Ho-Chuan (River) Huang
              Stata 17.0, MP(4)

              Comment


              • #8
                Dear Professor River
                If you do not want to abbreviate the lengthy lables / variable names, you can use the option abb(.) for no abbreviation at all. abb(30) will restrict the number of characters to 30.
                Code:
                asdocx cor $all, label fs(8) dec(4) save(log\T2-cor.doc) replace abb(.)
                And for aligning variable names in the list command, I shall come up with an update later on.
                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


                • #9
                  Dear Attaullah, Thanks a lot for the reply. I am looking forward to the update.
                  Ho-Chuan (River) Huang
                  Stata 17.0, MP(4)

                  Comment


                  • #10
                    The list command with asdocx aligns the variable names towards the left of the table cells for 2nd column and onwards and to the right for the first column. Here is an example
                    Code:
                    sysuse auto, clear
                    asdocx list make price mpg in 1/10, replace
                    Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	30.8 KB
ID:	1593714
                    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


                    • #11
                      Dear Attaullah, Thanks. Do I need to update asdocx?

                      Ho-Chuan (River) Huang
                      Stata 17.0, MP(4)

                      Comment


                      • #12
                        Dear Prof River
                        No, these settings are defaults and are there from day one.
                        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


                        • #13
                          Dear Attaullah, Got it and thanks.

                          Ho-Chuan (River) Huang
                          Stata 17.0, MP(4)

                          Comment

                          Working...
                          X