Opening the same MS Word document in a second window — the feature that you never knew you wanted.

I wish I knew about this feature in college.

Here’s the problem: You are writing one part of a word document but need to look at the content of another. Say, you are writing the abstract and are plucking relevant parts from the intro, methods, results, and discussion sections. Or, you are writing the results section and need to see the content of the tables and figures way below.

Tables are in a different spot so you need to scroll back and forth while writing it. This used to drive me bonkers.

BUT WAIT! MS Word allows you to have multiple windows open looking at and editing the same document!

Under the ‘View’ tab, click New Window.

This will open up the same document in a second window. One will have a ‘1’ after the end of the file name on the top bar and the other will have ‘2’. (You can open up as many duplicate windows as you want, actually. The numbers will just keep getting higher.) Editing the document in one window will modify the content in the other.

Now you can look at the tables while writing the results section without scrolling up and down. This is incredibly helpful when you are writing the abstract or the results section.

Extracting numbers from strings in Excel

Stata’s great at taking raw numbers and chugging out graphs with minimal edits. Often times you’ll get results that aren’t raw numbers, but instead will exist as a string. Instead, of getting:

…you’ll get

My previous strategy has been to manually extract these numbers into rows and columns. I just came across these two pages of Excel strategies that will pluck the numbers in the second picture and produce the first one!

Step 1: Split strings into separate columns.


Here, we’ll split the string at the spaces. There are two spaces, so you’ll end up with three new variables. First, make three new ‘temp’ columns to the right. You’ll need a different code for each section’s destination cell.

Left bit, or “0.80”:

=LEFT(A2, SEARCH(" ",A2,1))

Middle bit, or “(0.70,”:

=MID(A2,SEARCH(" ",A2,1)+1,SEARCH(" ",A2,SEARCH(" ",A2,1)+1)-SEARCH(" ",A2,1))

Right bit, or “0.90)”:

=RIGHT(A2,LEN(A2)-SEARCH(" ",A2,SEARCH(" ",A2,1)+1))

This assumes that your string of interest is sitting cell A2. Change this cell reference as needed. If all goes well, you should have new cells that look like this:

Step 2: Pluck numbers from strings.


Welp, there’s still some non-numeric text here. Time to pluck out the raw numbers! We’ll pretend that the ‘hrtemp’ cell also has a non-numerical character in it (e.g., a percent sign) for completeness’ sake. (Excel actually considers it a string still, which is why it’s not showing as “0.8”). Make 3 new rows to the right and use this code to extract the raw numbers contained in the string:

=(SUMPRODUCT(MID(0&B2, LARGE(INDEX(ISNUMBER(--MID(B2, ROW(INDIRECT("1:"&LEN(B2))), 1)) * ROW(INDIRECT("1:"&LEN(B2))), 0), ROW(INDIRECT("1:"&LEN(B2))))+1, 1) * 10^ROW(INDIRECT("1:"&LEN(B2)))/10))/100

…obviously, you’ll need to change the B2 cell to C2 and D2 as needed. You should get:

Boom! You should be able to copy to strings in subsequent rows by hovering over the bottom right of each cell and dragging down. Now you can “import excel” in stata and use your hr, low95, and high95 variables!