I am constructing a large timeseries dataset, with cases arranged around WDI_code (World Development Index) and year (variable names bold).


WDI_code year Variable a...
AFG 1975 n
AFG 1976 n




[apologies for not using 'dataex' to share, I got an error message 'input statement exceeds linesize limit. Try specifying fewer variables
r(1000);
' when I tried]

There are currently around 200 variables in Dataset A, and I'm looking to add in around 100 more from another source (Dataset B). My problem comes from the arrangement of Dataset B:

WDI_code Indicator 1975 1976...
AFG Variable x n n
AFG Variable y n n
ALG Variable x n n
ALG... Variable y n n
I've tried (and failed) to do a 'normal' transposition in excel, and in stata 'xpose, clear' is getting error message 'no room to add more variables
Up to 5,000 variables are currently allowed, although you could reset the maximum using set maxvar; see help memory.
r(900);
'.

I think that I need to do something through reshape to change Dataset B, so that in an 'add variables' merger with Dataset A I can match according to key variables WDI_code and year. But I don't know what, and can't find sufficient guidance...

Any pointers would be hugely appreciated!