Announcement

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

  • Can you find/replace in selection in do-file editor Stata 13.1/IC for Mac?

    Is there a way to do a find and replace in a selection using Stata 13.1/IC for Mac? That is, can you highlight some text in the do-file editor and only find and replace in that selection? I can easily do this on a PC but perhaps the functionality is not available on Mac?

    Thanks in advance for the help!

  • #2
    I confirm your experience - I don't see a way, on my Mac, of limiting find and replace to a selection. Perhaps on Windows that's an elementary part of the standard find-and-relplace support for text files, in a way that it is not on macOS. I note for example that the find-and-replace dialog in TextEdit is remarkably similar to that in Stata.

    That perhaps is one of the reasons I tend to use BBEdit for editing do-files except when I'm building a simple do-file to answer an question here.

    Comment


    • #3
      William, thanks for confirming this. I will try another text edit file for do file editing in the future.

      Comment


      • #4
        There's a way, but it seems to be buggy. For some reason, the first one replaces all (not just in the selection), but the second one works as expected:

        Comment


        • #5
          I'd missed the dropdown on Replace All. It was buggy for me, as it was for Dimitriy, and only seemed to function as expected when the selection began with the first character on the fist line.

          I note also that TextEdit supports "replace all within selection" by clicking and holding on the All next to the Replace button. But it works as expected on the same text that failed in Stata.

          This could be worth reporting to technical support at Statacorp.

          Comment


          • #6
            Dimitry and William, thanks. Unfortunately when I try to do a replace in selection in my do-file editor the "replace all" button doesn't have a drop down menu when I highlight a selection to replace. Which Stata version are you using? I'm in Stata 13.1/IC. Let me know on this question and then I'll report to Statacorp.

            Comment


            • #7
              I have Stata 14.1. Unfortunately I don't have 13.1 installed on this machine to try.

              Comment


              • #8
                Okay. Thanks for the info!

                Comment


                • #9

                  I'm using Stata 14.1 for Mac. I generate the problem with the following sequence, which I think is basically what Dimitriy does in his video.
                  1. launch Stata
                  2. open the do-file editor window
                  3. type "Now is the time" on the first, second, and third lines
                  4. WITHOUT nothing selected, choose Edit... Find... Find and Replace...
                  5. type e into the find field
                  6. NOW select the second line
                  7. The dropdown arrow appears to the right of Replace All
                  8. Click the dropdown arrow and choose Replace all in selection
                  9. Both occurrences of "e" vanish from line 1 and from line 2 but neither vanishes on line 3
                  So if you don't get the dropdown arrow at step 7, let us know and I'll file a report. Frankly, I'm used to doing the selection before choosing Find and replace in other applications like TextEdit; I find Stata's version unintuitive. TextEdit allows the selection either before or during the find-and-replace process; Stata seems to forget the selection if it's made before, and if made after, incorrectly treats the start of the file as the start of the selection.

                  Comment


                  • #10
                    That's correct I don't get the drop menu when I follow those steps.

                    Comment


                    • #11
                      OK, I'll report it; their implementation in 14.1 is clearly problematic, but their implementation in 13.1 is apparently nonexistent.

                      Comment


                      • #12
                        Thanks! Go team find and replace.

                        Comment


                        • #13
                          The Replace all in selection bug has been fixed and will be in a future update for Stata 14.

                          This functionality was added to Stata 14 and is not available in Stata 13.
                          -Chinh Nguyen

                          Comment


                          • #14
                            Thanks Chinh. When I update to 14 I will be excited to use the new functionality. Rebecca

                            Comment


                            • #15
                              The bug described in #9 above has been corrected in release 14.2 of Stata for Mac.

                              Comment

                              Working...
                              X