I am working with a large dataset of nearly 3 million observations on house prices in the UK from year 2019 to 2020.
I need to merge together two variables into one, split by region.
For example, I would like to merge x2019 and x2020 into a new variable y, which is linked through region.
Both of these variables came from different datasets.
I need this to be in a panel data format so I can plot out the coordinates of y with x1 and x2 on the axis.
Below is an example of my x2019 and x2020 variables using dataex.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double(x2019 x2020) . .42308459033822843 . . .24348377773469856 . . .4683997003237069 . .16909276343238608 .5787574449282433 . .1365918764292748 . . .460714720318014 .3303238932587331 . .265934841146259 . .28729663560259044 . .2716066023747963 . .4123490338164251 . .23285661071666422 . .1664648289168497 . . .3152704688759304 . .4914925660087157 . .4752179752286342 . .36603411584390955 .1561791497567391 . . .2119552035328655 .19282310232009203 . .27372177496442 . .3488016048991659 . . .5945918777643747 .20533381933053885 . .38149989641599336 . .24573953472471496 . .2409179992615105 . .2804320544998207 . .08273121387283237 . .40612155515127013 . .3170900748034319 . . .5224719101123596 . .617407502569373 .24407748862177617 . . .22166680704118588 . .4852172147100137 .2582730389985398 . .5766047242033632 . .2641388540836086 . . .27048574101063716 . .4648585410036104 .21969389376312956 . .17276593457535794 . .10039173195532589 . .39619787280496555 . . .33669012713161045 .21956334215770845 . . .30773099456483377 .22532540034566617 . .362444120625355 . .14336389298293822 . . .24082764998266096 .09470704857306829 . . .3798186432956592 .18431877215559644 . .24290262090619685 . . .2777777777777778 .09690204108593699 . .21872986810429593 . . .3840880389680678 . .2912608059294722 .24347066248098645 . .2864613226197309 . .4615424505797673 . . .24955764342321687 . .22979053294013924 .43715965430359516 . . .1758399864586566 . .4808308192155953 . .33978913591565435 . .2718742870180242 .3155639176335319 . . .17306037245243633 .3491067799904582 . . .348773754149255 .1671383130415707 . .2812089711833895 . . .34860474802165764 . .2861936922090452 . .33535291577214604 . .5764460194912037 .42285143667053215 . . .338753524812995 . .24162223914699163 . .20313215030253726 . .5341546825675202 . .4235055939200899 . .4456736248158546 . .3978756638550453 .3576040781648258 . .22698625440264314 . . .3287705999796961 .4423823797732308 . .26536086800143865 . .15740628264619422 . .22256726982529795 . .25606091647886364 . . .419142689371697 end
If anyone has any suggestions on how to go about this I'd greatly appreciate it.
I am using Stata 15.1 for Windows 10.
Many thanks in advance,
James.
0 Response to Merging two variables from different datasets
Post a Comment