Archive for the ‘Hacks’ Category

Installing SAS 9.2 under Ubuntu 9.10 (Karmic)

March 29, 2010 Leave a comment

Insert the SAS installation disk and start the installation script with

sudo /media/cdrom0/

(The path to you CD-ROM drive may differ slightly.)

You need to provide the location of your SAS license file and of the Java Runtime Environment. For the latter, you can have SAS install version 1.5 for you. If you want to use your existing version, you can find it by typing

locate 'bin/java'

into a new terminal window.

If the system throws an error after starting the installation, click on the ‘Retry’ button and read the error message in the console window popping up. Most likely, it will be ‘/bin/sh: Illegal option -p’

This error message comes up if bash is not your default shell (it’s usually dash on a fresh Ubuntu install). You can easily change that by typing

sudo rm /bin/sh
sudo ln -s /bin/bash /bin/sh

into a terminal window. After that, the installation should run smoothly and you can accept all the default selections.
To create a Desktop or panel shortcut at the end of the installation, use

/usr/local/SAS/SASFoundation/9.2/sas -work /tmp

To restore dash as your default shell (dash has a lower overhead than bash), you can do

sudo rm /bin/sh
sudo ln -s /bin/dash /bin/sh

Categories: Hacks, Science

Installing StatTransfer 10 on Ubuntu 9.10 (Karmic)

March 18, 2010 Leave a comment

OK, here we go again… just as with Stata it’s great to have a Linux version of StatTransfer available but there’s some quirks to overcome before it will run smoothly.

Please note: Circle Systems (the makers of S/T) recommends that you install their software as a non-root user in your home directory. I personally prefer to separate my applications and my data, therefore I install it with sudo. If you are not sure what you are doing and you rather to be on the safe side, install S/T as a non-root user. In that case, you will only have to install that older C++ library version (see below) to make S/T run on your machine.

After downloading the installer file to your Desktop, open a terminal and do

chmod +x ~/Desktop/stlinux32_install # make file executable

sudo ~/Desktop/stlinux32_install # install it

The program will install in /usr/local/stattransfer10. A user configuration directory will be created in your /home folder. Because you installed with sudo, the file is owned by root. Doing

sudo chown -R yourusername:yourusername ~/.stattransfer10

will make the file readable and writable for you.
Now try to start S/T using the Desktop shortcut. If the GUI comes up, you can proceed with the licensing procedure. If not, try to start it from the Terminal


Chances are you get an ‘ error while loading shared libraries: cannot open shared object file: No such file or directory’.

I tried the symbolic link trick that worked so well with Stata but it didn’t cut no ice with StatTransfer. However, installing an older version of libstdc++ worked. Download the package and install by doing

cd ~/Desktop
sudo dpkg --install libstdc++5_3.3.6-17ubuntu1_i386.deb

To activate your copy, you have to run S/T as root:

sudo /usr/local/stattransfer10/stattransfer

Go to About, press Activate Online, and follow the instructions. Once activated, run S/T only as a non-root user.

Categories: Hacks, Science

Tune the OpenOffice Startup

February 5, 2010 Leave a comment

Remove the ugly brown splash screen
sudo sed 's/Logo=1/Logo=0/' -i /etc/openoffice/sofficerc

Disable the automatic loading of the Java Runtime Environment on startup
Go to Tools > Options > > Java and remove the checkmark for ‘Use a Java runtime environment’

You are in business.

Categories: Hacks, Office

Run Stata 10/11 with GUI under Ubuntu

January 24, 2010 19 comments

Stata 10/11 are available for Linux, which is great but… after installing Stata (dynamically linked) under Ubuntu, starting the GUI version (xstata) usually results in an error message because one or more libraries apparently cannot be found.

By adding the corresponding symbolic links

sudo ln -s /usr/lib/libgtk2.0-0 /usr/lib/libgtk-1.2.0

sudo ln -s /usr/lib/ /usr/lib/

sudo ln -s /usr/lib/ /usr/lib/

Stata can be tricked into using the newer version instead of the old version it is expecting.

As Julian pointed out below, Stata 11 may close unexpectedly when starting the .do file editor. If that happens (I reproduced that bug on a fresh Karmic install), installing libgtksourceview 1.0 may fix the problem:

sudo apt-get install libgtksourceview1.0-0

Natty Narwhal update: After upgrading to 11.04, I got an error message (“error while loading shared libraries: cannot open shared object file: No such file or directory.”) when trying to run Stata. I fixed it by creating another symbolic link:

sudo ln -s /usr/lib/i386-linux-gnu/ /usr/lib/

Oneiric Ocelot update: Thanks to Charles Opondo for pointing out that libgtksourceview1.0 is not in the Oneiric repos.
You can either 1) download and install libgtksourceview from the Natty repos or 2) re-install the statically linked version of Stata.

– Option 1 –
cd ~/Desktop
sudo dpkg --install libgtksourceview-common_1.8.5-2build1_all.deb
sudo dpkg --install libgtksourceview1.0-0_1.8.5-2build1_i386.deb
rm libgtksourceview*.deb

– Option 2 –
Delete your Stata installation in the /usr/local/stata folder and re-install it from the disk. During the installation, Stata asks whether you want to install the 32-/64-bit dynamically/statically linked version. Choose statically linked.

Whichever way you choose, please update Stata 11 after installing it before doing any analyses. There is a serious bug in the original CD version that can completely muck up your results. You have to run Stata as a superuser to do that

sudo /usr/local/stata/xstata

Replace xstata with xstata-se if you are using Stata/SE.
Then, in Stata, type update all and when prompted update swap. When you are done, restart Stata as a normal user. It should now say “Stata 11.2” in the title bar.

Categories: Hacks, Science

Turn off the annoying system beep

January 24, 2010 Leave a comment

Sitting in the library or classroom with your laptop and the annoying system beep is causing all heads to turn and people give you dirty looks? Simply unload the pcspkr kernel module:

sudo modprobe -r pcspkr

If you want to remove it for good, add the line

blacklist pcspkr

to /etc/modprobe.d/blacklist.

Categories: Hacks, Sound