How-to guide: I want to download data

To continue exploring our datasets, return to statistics.gov.scot

Our website offers a variety of ways to download data. This guide describes how to:

  • Download whole datasets in csv format
  • Download a subset of a dataset, in csv format
  • Create a bespoke collection of data from one or more datasets, and use the data cart to download it in csv format

One of the most important tasks that our users use statistics.gov.scot for is downloading data for further analysis. There are a few different ways that you can achieve this.

To begin with, when viewing a dataset, you often have the option of downloading the whole dataset. As an example, let’s have a look at some of the data on patients registered with general practices. Hover over the ‘Search’ tab in the toolbar, enter the term ‘gp’ and click go.

In the list of search results, select the dataset ‘General Practice List Size’. Scroll to the bottom of the dataset page, you will see the option to download the whole dataset, either as a csv or as n-triples. A csv will open in standard spreadsheet software, such as Excel. N-triples is a specialist file format for linked data, which is intended for developers.

The option to download the whole dataset as a csv is available for most datasets. However, for the largest datasets this feature is not available. Instead, you can filter the dataset to create a dataset ‘slice’, which can be downloaded.

For example, imagine that we are interested in population, and want to look at the number of people living in different administrative areas. In the search tab, enter ‘population estimates current’ and select the search result: ‘Population Estimates (Current Geographic Boundaries)’.

We need to start locking down the dimensions to obtain actual data - like applying a filter. To get to a "spreadsheet" style view of the data, you must lock down all but one of the dimensions – the dimension that you leave unlocked will form the columns of the table that you generate.

Let's select the "All" value in the Age dimension. A small padlock icon will appear. Then, select "Count" in the Measure Type dimension.

Finally, select ‘All’ for Sex. A table will appear, with years as the column headers, and geographical units as rows. If you scroll to the bottom of the page, you will see that you can download this particular dataset slice as a csv.

Downloading the slice will give you a csv with a table of the selected dimensions (in this case, a count of all ages and all genders) for all of the types of geographical area in the dataset.

But what if we are only interested in one type of geography? If, for example, we only want local authority data, then you can use the data cart to get that specific subset of data. You can also create collections of dataset slices from multiple datasets, and create your own collections of individual geographical units.

At the top right of the table of data, you’ll find a shopping cart icon. Click on the cart icon to add the dataset slice to your cart.

At the bottom of the screen you should see "Your data cart contains 5 slices of data and 0 geographical areas".

We can add in slices from other datasets too: use the search tab to find the ‘General Practice List Size’ dataset again, select ‘Count’ in the Measure Type dimension, and then click on the shopping cart icon above the spreadsheet. At the bottom of the screen you should now see "Your data cart contains 16 slices of data and 0 geographical areas".

To complete the data cart, you’ll need to load in the geographical area or areas that you are interested in. But be aware – some datasets don’t contain information for every geography type (scroll to the bottom of the page on any dataset to see a list of the geography types covered). Go to the Explore option in the toolbar, and select ‘By area’.

In this example, we are interested in local authorities, so select ‘Council Areas’ from the diagram of geographies and click on the shopping cart icon to add these to your cart. Both of the datasets currently in the cart, General Practice Size List and Population Estimates (Current Geographic Boundaries), contain data at Council Area level.

You could, if you wanted, add in other geographical units, such as data zones. We now have data and geographies in our cart, and so we can now download a csv. At the top of the screen, hover over the tools menu and click ‘Your data cart’.

You’ll see a screen showing the items that you’ve added to the cart (in this case, 5 columns of data and 32 geographic areas). Click on ‘Save Cart’ to save the data cart.

On the screen which appears you will be able to download the contents of your cart by clicking the 'CSV' button. The hyperlink created for this cart is a permanent link; so you can save this to access the cart again in future. You can bookmark it, or share it with someone else, allowing them to access the data.

The link for this example use of the data cart is http://statistics.gov.scot/carts/fbc88745-065a-4706-90c2-cf898e247ca0

It’s also possible to use the data cart to extract data for multiple individual areas, such as individual data zones or council areas. You can find guidance on how to do this in the blog post: ‘How-to guide: find and extract data for multiple areas at once using the Data Cart’.

SUMMARY
1. Use the download whole dataset as csv option, where available, to download entire datasets
2. Lock values in a dataset to generate a spreadsheet style table, and use the download this slice option to extract the table as a csv
3. Use the data cart to assemble collections of data and geographies that you are interested in, and extract them as a csv

To continue exploring our datasets, return to statistics.gov.scot