Dear Stata users,
I have a raw database of climatic data at a regional level that can be found here:
https://crudata.uea.ac.uk/cru/projec.../recon/#paul05
I would like to have this data in a Stata wide/long format. I will provide a very basic example of how the data look like and what I would like to accomplish.
Say the data in raw format look like this:
In this, the first line has information about the year (cell 1, year 2000) and the season (cell 2, season 1). The lines from 2 to 5 have information about specific coordinates. That is, each cell is a region based on coordinates. For example, the second line is for latitude 55.75, the third line for 55.25, the fourth line for 54.75, and the fifth line for 54.25. Furthermore, each column represents a longitude point. Say the first column is for 30.75, the second for 30.25, the third for 29.75, and the fourth for 29.25. Hence, the cell in line 2 and column 1 is the region with coordinates (55.75, 30.75) in the year 2000 (season 1) with the value 0.09.
The whole process repeats itself. Thus, line 6 introduces another year (year 2001 and again season 1) and the coordinates are the same as before. With coordinates included the data would look like this:
The aim is to transform the raw data in a friendlier format (such as a wide, or long format, so that they can be used as an input in a software such as ArcGis. I was thinking something like this.
There is a pattern in regions repeating themselves, so I would assume that one could obtain a friendlier version of the data.
I would be very grateful if people who have used this data before, or have dealt with a similar problem in the past have some advice to offer.
Thank you for your time.
I have a raw database of climatic data at a regional level that can be found here:
https://crudata.uea.ac.uk/cru/projec.../recon/#paul05
I would like to have this data in a Stata wide/long format. I will provide a very basic example of how the data look like and what I would like to accomplish.
Say the data in raw format look like this:
Code:
clear all set more off input /// var1 var2 var3 var4 2000 1 . . 0.09 0.40 0.53 0.96 0.91 0.88 0.74 0.50 0.68 0.14 0.44 0.29 0.45 0.65 0.20 0.68 2001 1 . . 0.48 0.08 0.66 0.72 0.04 0.66 0.91 0.66 0.79 0.49 0.32 0.26 0.49 0.81 0.54 0.31 end
The whole process repeats itself. Thus, line 6 introduces another year (year 2001 and again season 1) and the coordinates are the same as before. With coordinates included the data would look like this:
Code:
clear all set more off input /// A B C D E . 30.75 30.25 29.75 29.25 . 2000 1 . . 55.75 0.09 0.40 0.53 0.96 55.25 0.91 0.88 0.74 0.50 54.75 0.68 0.14 0.44 0.29 54.25 0.45 0.65 0.20 0.68 . 2001 1 . . 55.75 0.48 0.08 0.66 0.72 55.25 0.04 0.66 0.91 0.66 54.75 0.79 0.49 0.32 0.26 54.25 0.49 0.81 0.54 0.31 end
Code:
clear all set more off input /// Latitude Longitude year2000 year2001 55.75 30.75 0.09 0.48 55.75 30.25 0.40 0.08 55.75 29.75 0.53 0.66 55.75 29.25 0.96 0.72 55.25 30.75 0.91 0.04 55.25 30.25 0.88 0.66 55.25 29.75 0.74 0.91 55.25 29.25 0.50 0.66 54.75 30.75 0.68 0.79 54.75 30.25 0.14 0.49 54.75 29.75 0.44 0.32 54.75 29.25 0.29 0.26 54.25 30.75 0.45 0.49 54.25 30.25 0.65 0.81 54.25 29.75 0.20 0.54 54.25 29.25 0.68 0.31 end
I would be very grateful if people who have used this data before, or have dealt with a similar problem in the past have some advice to offer.
Thank you for your time.
Comment