Title | Column-mode selection in the Do-file Editor | |
Author | Mia Lv, StataCorp |
This keyboard shortcut varies across different operating systems.
In Windows, you can hold the Alt key and make your selection using the mouse.
In Unix, use the Ctrl key instead of the Alt key.
In Mac, use the Option key instead.
After you make a selection, you can type, delete, copy, and paste text in column mode.
If you have ever entered or edited your data in a text editor, you may find it helpful to use column-mode selection. Here we show several examples using the Do-File Editor in Windows.
One advantage of column-mode selection is that you can delete or append a variable easily if your data are in fixed format. For example, you are trying to create a dataset using the following commands.
clear input mpg rep78 headroom trunk weight length turn displacement 22 3 2.5 11 2930 186 40 121 17 3 3.0 11 3350 173 40 258 22 . 3.0 12 2640 168 35 121 20 3 4.5 16 3250 196 40 196 15 4 4.0 20 4080 222 43 350 18 3 4.0 21 3670 218 43 231 26 . 3.0 10 2230 170 34 304 20 3 2.0 16 3280 200 42 196 16 3 3.5 17 3880 207 43 231 19 3 3.5 13 3400 200 42 231 14 3 4.0 20 4330 221 44 425 14 2 3.5 16 3900 204 43 350 end
Now you want to modify your code to exclude the variable weight. If you use Windows, you can hold the Alt key and select the corresponding text, as shown in Figure 1.
Figure 1
Then, you can drop the selected part by clicking on the Delete key.
Assume now that you want to add a string variable unit with content “miles per gallon” next to the variable mpg. You can hold the Alt key and drag one vertical line on the right side of mpg observations, as shown in Figure 2.
Figure 2
With this selected, you type “mile per gallon”. You will see that this text is inserted in each selected row, as shown in Figure 3.
Figure 3
A single click in any place disables column-mode selection.
Copying and pasting a rectangle of data is very convenient with column-mode selection. Assume that you want to move the variable turn to the first column. You can first select the corresponding text just as we did before and right-click to cut it.
Figure 4
Then, you move your pointer to the upper-left corner where you want to paste the data and right-click to paste. You will see the content of the variable turn has been moved to the first place on the left side.
Figure 5
As we mentioned in the beginning of the FAQ, this keyboard shortcut varies across different operating systems. You can follow the instruction for your operating system to perform these types of edits using column-mode selection.
Learn
Free webinars
NetCourses
Classroom and web training
Organizational training
Video tutorials
Third-party courses
Web resources
Teaching with Stata
© Copyright 1996–2024 StataCorp LLC. All rights reserved.
×
We use cookies to ensure that we give you the best experience on our website—to enhance site navigation, to analyze usage, and to assist in our marketing efforts. By continuing to use our site, you consent to the storing of cookies on your device and agree to delivery of content, including web fonts and JavaScript, from third party web services.
Cookie Settings
Last updated: 16 November 2022
StataCorp LLC (StataCorp) strives to provide our users with exceptional products and services. To do so, we must collect personal information from you. This information is necessary to conduct business with our existing and potential customers. We collect and use this information only where we may legally do so. This policy explains what personal information we collect, how we use it, and what rights you have to that information.
These cookies are essential for our website to function and do not store any personally identifiable information. These cookies cannot be disabled.
This website uses cookies to provide you with a better user experience. A cookie is a small piece of data our website stores on a site visitor's hard drive and accesses each time you visit so we can improve your access to our site, better understand how you use our site, and serve you content that may be of interest to you. For instance, we store a cookie when you log in to our shopping cart so that we can maintain your shopping cart should you not complete checkout. These cookies do not directly store your personal information, but they do support the ability to uniquely identify your internet browser and device.
Please note: Clearing your browser cookies at any time will undo preferences saved here. The option selected here will apply only to the device you are currently using.