Hao's Economics Notes
economics, econometrics and the else 你要相信一个人可以飞翔 有着钢铁的身躯和柔软的心脏
Monday, September 2, 2019
Koma-scripts and titlesec packages are not recommended to be used together
The widespread Latex template for AJAE may need to be updated. Some conflicts between koma-scripts and titlesec packages are causing problems. Those problems won't be resolved unless either disable titlesec or the koma-scripts. I will upload my modified template in a while.
Thursday, April 18, 2019
How to run multiple STATA instances on macOS
As we all know, we can run multiple instances of STATA on a Windows machine, but on the macOS, only one instance can be active at the same time. Sometimes, we need to leverage parallel/extra computing power by utilizing more than one instance of STATA on a Mac computer. So, how can we run multiple instances of STATA on the Mac? In the following, I summarize 3 methods for you to choose from.
open -n "/Volumes/MacHD Storage/Applications/Stata/StataSE.app"
Replace the path with your path, and the name of STATA application when necessary. Last, press Enter.
2. Alias
If you feel annoying to type the length command each time when you want to run another instance of STATA, you can save it as an alias. First, open the terminal, then type in the following command
sudo nano /.bash_profile
This command allows using command line based text editor GNU nano to edit the profile file. Remember this has to be done under the superuser privilege so you will need to type in your superuser password. Second, type in the following command:
alias STA=open -n "/Volumes/MacHD Storage/Applications/Stata/StataSE.app"
This step is to make an alias of the command scripts in profile, and the alias is called STA.
Press CTL+O to save the file, and press CTL+X to exit the editor. Then log out and log in again. Next time when you need to run another instance, just open the terminal and type in STA, and press Enter.
3. Executive File
You can also make an executive file that is doable in macOS (UNIX). Open any coding text editor, such as the BBEdit, Notepad++ or even Xcode, create a new text file, set the encoding format to be UNIX LF, set the text profile to be "Unix Shell Scripts", then copy and paste the following code (change the path when necessary) to the text editor:
#!/bin/bash
open -n "/Volumes/MacHD Storage/Applications/Stata/StataSE.app"
Then save it as a .sh file. Open Finder, find the .sh file you just saved and remove ".sh" from the name, then you will notice that the text file becomes an executive file. Next time when you need to run another instance, just double click the executive file.
(Or:
If it does not work, you will need to use a formal way. Suppose you named the ,sh file as STA_MI.sh, put in on the desktop. Open terminal, type in:
sudo chmod +x "~/Desktop/STA_MI.sh"
Then this file will be assigned an executable permission.)
I hope these methods help. You can leave any questions regarding this in the comment section, and I will answer them when possible.
References:
1. https://www.stata.com/statalist/archive/2010-08/msg00113.html
2. https://www.techradar.com/how-to/computing/apple/terminal-101-creating-aliases-for-commands-1305638
3. https://www.macobserver.com/tmo/article/os-x-how-to-convert-a-terminal-command-into-a-double-clickable-desktop-file
- Terminal Command
open -n "/Volumes/MacHD Storage/Applications/Stata/StataSE.app"
Replace the path with your path, and the name of STATA application when necessary. Last, press Enter.
2. Alias
If you feel annoying to type the length command each time when you want to run another instance of STATA, you can save it as an alias. First, open the terminal, then type in the following command
sudo nano /.bash_profile
This command allows using command line based text editor GNU nano to edit the profile file. Remember this has to be done under the superuser privilege so you will need to type in your superuser password. Second, type in the following command:
alias STA=open -n "/Volumes/MacHD Storage/Applications/Stata/StataSE.app"
This step is to make an alias of the command scripts in profile, and the alias is called STA.
Press CTL+O to save the file, and press CTL+X to exit the editor. Then log out and log in again. Next time when you need to run another instance, just open the terminal and type in STA, and press Enter.
3. Executive File
You can also make an executive file that is doable in macOS (UNIX). Open any coding text editor, such as the BBEdit, Notepad++ or even Xcode, create a new text file, set the encoding format to be UNIX LF, set the text profile to be "Unix Shell Scripts", then copy and paste the following code (change the path when necessary) to the text editor:
#!/bin/bash
open -n "/Volumes/MacHD Storage/Applications/Stata/StataSE.app"
Then save it as a .sh file. Open Finder, find the .sh file you just saved and remove ".sh" from the name, then you will notice that the text file becomes an executive file. Next time when you need to run another instance, just double click the executive file.
(Or:
If it does not work, you will need to use a formal way. Suppose you named the ,sh file as STA_MI.sh, put in on the desktop. Open terminal, type in:
sudo chmod +x "~/Desktop/STA_MI.sh"
Then this file will be assigned an executable permission.)
I hope these methods help. You can leave any questions regarding this in the comment section, and I will answer them when possible.
References:
1. https://www.stata.com/statalist/archive/2010-08/msg00113.html
2. https://www.techradar.com/how-to/computing/apple/terminal-101-creating-aliases-for-commands-1305638
3. https://www.macobserver.com/tmo/article/os-x-how-to-convert-a-terminal-command-into-a-double-clickable-desktop-file
Saturday, April 6, 2019
STATA 15 SE seems to loosely limit cores on macOS than on Windows
As we all know that the STATA SE edition can only utilize one core, which is essentially one thread. But, the things might be different on macOS and Linux. I have been running the same simulation code, and found that the performance seems to be substantially better on macOS and Linux compared to it is on a PC. I will post details later if I confirm this finding.
Tuesday, January 29, 2019
Install TeXStudio and Dropbox on Ubuntu
1. Install TeXStutio
open terminal, and type in:
sudo add-apt-repository ppa:sunderme/texstudio
open terminal, and type in:
sudo add-apt-repository ppa:sunderme/texstudio
(if old version already installed: sudo apt-get remove texstudio-d)
sudo apt-get update
sudo apt-get install texstudio
2. Dropbox (permission issues)
sudo chmod +s /usr/lib/policykit-1/polkit-agent-helper-1
sudo dpkg --configure -a
sudo dpkg --configure -a
Tuesday, June 17, 2014
Possibly best way to output statistic summaries
estpost sum wheat_2_value wheat_7_value wheat_12_value hay_1_value if xxxx==xxx
esttab using ss.rtf, cells("mean(fmt(2)) sd(fmt(2)) min(fmt(1)) max(fmt(0))") nomtitle nonumber replace label
Source: http://21cresearcher.blogspot.com/2009/09/stata-how-to-export-descriptive.html
esttab using ss.rtf, cells("mean(fmt(2)) sd(fmt(2)) min(fmt(1)) max(fmt(0))") nomtitle nonumber replace label
Source: http://21cresearcher.blogspot.com/2009/09/stata-how-to-export-descriptive.html
How to let outsum work on Stata 12
Outsum package is now incompatible with newest versions of Stata, i.e. version 12 and version 13. However, you can do some modification to the outsum ado file to let it work in new versions. To do this, follow the below steps.
1. Type "which outsum" and run it to locate path of outsum.ado file, usually it is supposed to be "c:\ado\plus\o\outsum.ado". Then copy the path.
2. Type "doedit [paste your outsum.ado path here, not brackets]" and run it, a code editing window will pop out.
3. Press Ctrl+H to open replace window. find all "_all" and replace them with "*". Then save the file.
4. run "cscript" to clean the memory and reload all ado files.
Now outsum will work in later versions of Stata
Friday, November 29, 2013
Some thoughts on large data processing
First be ready for digit/string tricks.
Stata recommended. SAS sucks.
Why SAS sucks? Will do a separate post to discuss it.
Need to have a full license of StatTransfer
Be ready to compress data using compress command in Stata.
Use a codebook.
Do not try to append all the data files into one file. Should put them within one folder and create global code to index them.
Stata recommended. SAS sucks.
Why SAS sucks? Will do a separate post to discuss it.
Need to have a full license of StatTransfer
Be ready to compress data using compress command in Stata.
Use a codebook.
Do not try to append all the data files into one file. Should put them within one folder and create global code to index them.
Subscribe to:
Posts (Atom)