Announcement

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

  • graph option by and (sub)title facet

    Hi!

    How would one go about changing Domestic to let's say "Domestic XXX" and Foreign to "Foreign XXX" without changing the original value labels? Is there a way to edit without using the Graph Editor? When I use the option subtitle, I can change Domestic to Domestic XXX but Foreign also changes to Domestic XXX.

    Many thanks in advance for a solution



  • #2
    No omelette without breaking some eggs. You could just define some new value labels, assign them, use them in a graph, and then change back to the original value labels.

    Comment


    • #3
      But you can make boiled eggs without breaking them. See -help label language-. Create a new label language, copy the original label to it, and then modify the label in the new language. Use it to make your graph. Then reset to the original language, and, if there is no other need for it, delete the new one.

      Comment


      • #4
        #3 looks to me the same main idea as #2.

        Either way round, you have to define and use new or revised value labels.

        There is no code in #1. I can get a similar graph using tabplot from the Stata Journal. If it was done another way, fine by me, but this is the kind of sequence I had in mind.


        Code:
        clear
        sysuse auto
        
        tabplot rep78 if rep78 > 2, by(foreign) percent(foreign) separate(foreign) showval
        
        label def origin2 0 "Domestic (USA)" 1 "Foreign (not USA)" 
        
        label val foreign origin2 
        
        * same code, but different result 
        tabplot rep78 if rep78 > 2, by(foreign) percent(foreign) separate(foreign) showval
        
        label val foreign origin

        There is a more diffuse strategic point, a point that is vital for some users. The technique for one-off conversions is not necessarily optimal for sustained working in two or more parallel modes. For example, some users may need to develop two sets of graphs that are identical but one set uses English and the other uses Spanish. And so on. I guess this is the kind of context that Clyde Schechter may have in mind.

        Comment


        • #5
          I guess this is the kind of context that Clyde Schechter may have in mind.
          Yes, it is. Actually, if memory serves, when Stata introduced -label language- (a long, long time ago) I think they also suggested that one might create labels in one "language" for tabular output and another "language" for graphs, the differences being not which tongue is used, but that one context might allow for longer text and the other require abbreviated versions.

          Finally, if only out of curiosity, I would love to know why O.P. is so averse to changing the original labels. After all, if the data set is not re-saved, the original labels will remain for future uses of the data set. Or if the original labels are required later in the same do-file, the changes can always be reversed.

          Comment


          • #6
            thank you both for your advice

            Comment

            Working...
            X