Extract Data from BFS STAT-TAB

The Swiss Federal Statistical Office BFS has a lot of valuable open data that is just in the wrong format. The STAT-TAB database allows anyone to download the data in the PX data format. To transform this data into a better format requires a few steps that are explained in this tutorial.

Download Data Cube

On the STAT-TAB website download a data cube of your interest in the PX format. In my case I am interested in all data about swiss communities.

Download PX File from STAT-TAB website

Setup PX-Axis 2008

Download and install PX-Axis 2008 on a Windows XP machine. The easiest way to get started is using a XP VM image from the Modern.IE project which provides free VM images in different formats for different Windows versions.

Open File in PX-Axis

Open the file with PX-Axis and select the dimensions you want to export. To export the data into CSV it is best to omit the aggregated values and focus on a single dimension.

Open file with PX-Axis View of file in PX-Axis

Export as CSV

Use File > Save as to open the export wizard. Switch to the Convert tab and choose the CSV format for export.

Convert file to CSV in PX-Axis

Clean up CSV

Because we’ve selected only a single dimension we can now delete the first dimension column and have a valid CSV file that we can use in other programs.

Valid CSV file