Greetings,

I'm running Stata 15.1 on OSX. I suspect the subject line was confusing so allow me to explain: I have a panel dataset where most of the variables have already been shaped from wide to long. One of the variables, 'twitter_', is missing data for a specific year (2013). I subsequently realized that one of the wide variables ('twitter_ever2013'), which was only measured in 2013, could be used to fill in the data for this year. The question is how to reshape 'twitter_ever2013' from wide to long and merge it with 'twitter_use'. Is this possible or do I have to start with a pre-shaped dataset (i.e. from scratch)?

Here is a sample of the data I'm currently looking at:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(twitter_ twitter_ever2013) int year double caseid
. . 2012 989870
. . 2014 989870
. . 2015 989870
. . 2017 989870
0 0 2012 989871
. 0 2014 989871
. 0 2015 989871
. 0 2017 989871
. . 2012 989872
. . 2014 989872
. . 2015 989872
. . 2017 989872
. . 2012 989873
. . 2014 989873
. . 2015 989873
. . 2017 989873
0 0 2012 989874
. 0 2014 989874
. 0 2015 989874
. 0 2017 989874
0 0 2012 989875
0 0 2014 989875
0 0 2015 989875
0 0 2017 989875
0 0 2012 989876
0 0 2014 989876
0 0 2015 989876
0 0 2017 989876
0 0 2012 989877
0 0 2014 989877
0 0 2015 989877
0 0 2017 989877
0 0 2012 989878
0 0 2014 989878
0 0 2015 989878
. 0 2017 989878
. . 2012 989879
. . 2014 989879
. . 2015 989879
. . 2017 989879
0 0 2012 989880
0 0 2014 989880
0 0 2015 989880
0 0 2017 989880
0 1 2012 989881
0 1 2014 989881
. 1 2015 989881
. 1 2017 989881
. 0 2012 989882
. 0 2014 989882
. 0 2015 989882
. 0 2017 989882
0 0 2012 989883
1 0 2014 989883
1 0 2015 989883
0 0 2017 989883
0 0 2012 989884
0 0 2014 989884
0 0 2015 989884
0 0 2017 989884
. . 2012 989885
. . 2014 989885
. . 2015 989885
. . 2017 989885
1 0 2012 989886
1 0 2014 989886
. 0 2015 989886
1 0 2017 989886
. . 2012 989887
. . 2014 989887
. . 2015 989887
. . 2017 989887
0 0 2012 989888
0 0 2014 989888
0 0 2015 989888
0 0 2017 989888
1 1 2012 989889
1 1 2014 989889
1 1 2015 989889
0 1 2017 989889
1 1 2012 989890
. 1 2014 989890
. 1 2015 989890
. 1 2017 989890
. . 2012 989891
. . 2014 989891
. . 2015 989891
. . 2017 989891
0 0 2012 989892
0 0 2014 989892
0 0 2015 989892
1 0 2017 989892
0 0 2012 989893
0 0 2014 989893
0 0 2015 989893
0 0 2017 989893
0 0 2012 989894
. 0 2014 989894
. 0 2015 989894
. 0 2017 989894
end
label values twitter_ TECH5S67
label def TECH5S67 1 "yes", modify
Thanks in advance for your help!