Announcement

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

  • Put each item of a macro in quotes

    Hello,

    I'd like to create a local macro where each item is in quotes. The problem is that I have some items that have spaces between them.

    So, for example, I'd like a local that is something like:

    local pies = "blueberry cake" "apple pie" "cheesecake" "blueberry pie"

    etc.

    Every time I try a different iteration of compound and double quotes, Stata returns the maco clean in display. Any tips?

    Thanks!!

  • #2
    I read that displaying with: display `"`pies'"' protects the double quotes. But are they being stored?

    Comment


    • #3
      You can test this yourself:

      Code:
      . local pies  `"  "blueberry cake" "apple pie" "cheesecake" "blueberry pie" "'
      
      . mac li
      <stuff deleted> 
      _pies:           "blueberry cake" "apple pie" "cheesecake" "blueberry pie"
      Avoiding the equals sign helps in older versions of Stata.

      Comment


      • #4
        Thank you! This worked perfectly.

        Comment

        Working...
        X