Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65055

Reshape wide - coordinates level data

$
0
0
I have the following monthly data by coordinates (below). The data is by longitude and latitude, how can I reshape the data into wide form so that each column is a coordinate and each row is a month?
coordinate1 coordinate2 coordinate3...
Month1
Month2
Month3
.
.
.
Month12

I have tried to create an ID for each coordinate but ran intro trouble because of the negative sign. Is there a way around it? Thank you!

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str3 iso3 int lon byte(lat month) float precip
"AFG" 61 32  1   .9966658
"AFG" 61 32  2  .15671173
"AFG" 61 32  3   .2424774
"AFG" 61 32  4          0
"AFG" 61 32  5          0
"AFG" 61 32  6          0
"AFG" 61 32  7          0
"AFG" 61 32  8          0
"AFG" 61 32  9          0
"AFG" 61 32 10          0
"AFG" 61 32 11    .121536
"AFG" 61 32 12   .3886606
"AFG" 61 33  1   1.133129
"AFG" 61 33  2   .3552083
"AFG" 61 33  3   .3072774
"AFG" 61 33  4    .008316
"AFG" 61 33  5          0
"AFG" 61 33  6          0
"AFG" 61 33  7          0
"AFG" 61 33  8 .000836129
"AFG" 61 33  9    .048312
"AFG" 61 33 10 .016165162
"AFG" 61 33 11    .190656
"AFG" 61 33 12   .6389768
"AFG" 61 34  1  1.2373316
"AFG" 61 34  2   .6235324
"AFG" 61 34  3   .3563652
"AFG" 61 34  4    .017568
"AFG" 61 34  5          0
end

Viewing all articles
Browse latest Browse all 65055

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>