Hello everyone,
I have the following dataset:
I would like to reshape this dataset to obtain the just three columns; Year, Products and Price. To make it clear, for each year, I would like to have three observations, cocoa, coffee and tea, with his corresponding price.
I am trying the following:
But I am obtaining the following error:
"no xij variables found
You typed something like reshape wide a b, i(i) j(j).
reshape looked for existing variables named a# and b# but could not find any. Remember this picture:"
Anyone knows why? Thank you.
I have the following dataset:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int Year float(cocoa coffee tea) 1960 3.0769715 4.229965 5.419287 1961 2.452238 4.009644 5.043255 1962 2.3037343 3.809979 4.795938 1963 2.83032 3.661893 4.921299 1964 2.555764 4.5401278 4.6623535 1965 1.8284953 4.200999 5.066413 1966 2.498808 4.0256944 4.413181 1967 2.862174 3.836209 4.7431984 1968 3.4799714 3.894003 4.034715 1969 4.1133976 3.680444 3.297254 1970 2.907652 4.4372315 3.823453 1971 2.2035952 3.939136 3.692863 1972 2.418084 3.953175 3.0436306 1973 3.661782 4.003855 2.710703 1974 4.1471906 3.6465025 3.020196 1975 2.9806585 3.3346746 2.622963 1976 4.834464 7.042325 2.87251 1977 8.285694 11.04199 4.5912213 1978 6.402001 6.434844 3.024581 1979 5.552967 6.305437 2.750204 1980 3.991594 5.143401 2.785964 1981 3.184666 3.911836 2.487348 1982 2.739556 4.3495383 2.586328 1983 3.437219 4.5747886 3.103582 1984 3.972359 5.160637 4.658217 1985 3.777082 4.925164 2.6613636 1986 3.0147066 5.489634 2.48686 1987 2.6508186 3.159186 1.741554 1988 1.9779524 3.191044 1.6969632 1989 1.5584383 2.538469 1.9059527 1990 1.5316404 1.906847 1.7972807 1991 1.4591677 1.7981176 1.744895 1992 1.3184253 1.4102768 2.0120442 1993 1.2942352 1.574493 1.804751 1994 1.6678215 3.540815 1.8767424 1995 1.558678 3.320475 1.4161226 1996 1.6137103 2.49454 1.57755 1997 1.8844392 3.436564 2.3460581 1998 2.0393958 2.92208 2.310131 1999 1.4085815 2.3445048 2.2334988 2000 1.1379292 1.779329 2.5484505 2001 1.3952132 1.2926186 1.9799826 2002 2.348558 1.3331517 1.971048 2003 2.1995945 1.4006797 1.9392273 2004 1.8233513 1.5100135 1.8285294 2005 1.7538422 2.079065 1.6847206 2006 1.7707478 2.2310436 2.1716413 2007 2.0464036 2.4281344 1.745225 2008 2.5069225 2.6276815 2.1571958 2009 2.9935236 2.494976 2.610938 2010 3.133004 3.028018 2.560042 2011 2.684754 3.7764544 2.449512 2012 2.17048 2.893732 2.6138964 2013 2.2231965 2.3481514 2.1867213 2014 2.830166 3.0685036 1.89007 2015 3.202293 2.792256 3.028274 2016 3.075278 2.959683 2.5759604 2017 2.0857253 2.851354 3.052986 2018 2.2509995 2.3529108 2.530545 2019 2.3525846 2.2620804 2.2223198 2020 2.420699 2.471659 2.0505192 2021 2.2180362 2.967605 1.9303017 2022 2.1675537 3.584937 2.21719 end
I am trying the following:
Code:
reshape long cocoa coffee tea, i(Year) j(products)
"no xij variables found
You typed something like reshape wide a b, i(i) j(j).
reshape looked for existing variables named a# and b# but could not find any. Remember this picture:"
Anyone knows why? Thank you.
Comment