Hello everyone,

I have a panel dataset of firms over time that I am attempting to convert from ‘long’ to ‘wide’ (perhaps these terms are incorrect and I apologise if so but the code below should convey the idea).

The data has multiple observations of the same firm per year with fiscal information at every year (giving over 4 million observations). I would like to transform this into a single observation of one firm with a new variable for fiscal information at every year (hope this makes sense!).

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float firmid str4 closingyear double fixedassets
  1092 "1989"     60274810
  1092 "1990"     77463935
 87397 "1990"     40294909
  1092 "1991"     66114814
 25177 "1991"    991958993
 87397 "1991"     43335100
end
Referring to the table, I would need multiple fixed assets variables across years, like fixedassets1998, fixedassets1999 etc. I imagine this would require running a macro generating new variables but I have not successfully been able to do this.

I would appreciate any and all advice on this issue – do let me know if I have missed some important piece of information.
Thank you for your help and time!

Ana