Hi, I am newbie in STATA and right now I have data as in the attached picture. I want to import it to STATA as panel variant (second attachment). Can you please help?
-
Login or Register
- Log in with
import excel using spreadsheet_in_first_screenshot.xlsx, firstrow case(lower) clear
ds country code, not
local years `r(varlist)'
local n_years: word count `years'
forvalues i = 1/`n_years {
rename `:word `i' of `years'' y`=2001+`i''
}
reshape long y, i(country) j(year)
Comment