The Do-File Editor - Column Mode Selection

When selecting or highlighting text in the do-file editor, the default is to select text in rows. This underlined sentence shows what I mean by this, as selecting from the beginning to the end of it shows the default mode. However, when dealing with text in the do-file editor it is often useful to be able to select a column rather than just rows. Fortunately in the do-file editor (as well as standard text editors and Microsoft Word) it is possible to select in columns. An example of this is the column below, which is underlined to show the area selected.

Column

Line1

Line2

Line3

Line4

Line5

How to Use:

This column-select function works slightly differently depending on what operating system you are using. In all cases you select the column(s) you want by dragging across and down/up as appropriate.

Worked Example:

I have a do-file containing some data on cars. I am going to give a few examples of how to use the column-select mode.

Here is the unaltered do-file:

I want to change the order of the data in the do-file. I am going to use column-select to select the “max_speed” column, and I am going to cut it out and paste it in-between the “capacity(L)” and “kpl” columns. To do this I perform the following steps:

This is shown in the following progression of images:

Now I am going to perform one final task. I want to identify the type of car in my dataset. All of the cars I have listed are sedans, so I am going to type this into my dataset. However, rather than typing “sedan” into each row, I am going to type it into all rows at once using column-select. To do this I perform the following steps:

This is shown in the following progression of images:

Column-select can be used for many things in the Stata do-file editor and standard text editors. Shown above are a few simple examples.