Hi all,
I am having trouble with the reshaping long command. I have read the previous posts, but I was not able to find the solution to my problem. I would appreciate having your advice.
I want to reshape multiple variables at once.
These are some of the variables in the dataset. Each variable has 7 repeated measures, for instance, tax_1, tax_2, tax_3, tax_4, tax_5, tax_6, tax_7. Bellow, I only copied 2 of them.
* Example generated by -dataex-. For more info, type help dataex
clear
input str14 idspot long(bevfood_1 tax_1 regul_1 hical_1 hisug_1 hisatfat_1 hisod_1) str9(subcat_1 macrocat_1) long(bevfood_2 tax_2 regul_2 hical_2 hisug_2 hisatfat_2 hisod_2) str4 subcat_2 str7 macrocat_2
"040216_CHV_018" . . 999999999 999999999 999999999 999999999 999999999 "" "" . . 999999999 999999999 999999999 999999999 999999999 "" ""
"052816_C13_013" 2 0 1 1 0 0 0 "512" "5" 2 0 1 1 0 0 0 "512" "5"
"042716_CN_026" 2 0 0 0 0 0 0 "418" "4" 999999999 999999999 0 0 0 0 0 "418" "4"
"041216_M_051" 1 2 1 0 1 0 0 "201" "20" 1 2 1 0 1 0 0 "201" "20"
"052816_M_030" 2 0 1 1 0 0 0 "1211" "12.1211" 2 0 1 0 0 0 1 "1211" "12.1211"
"040216_M_025" 2 0 0 0 0 0 0 "1111" "11" 1 0 0 0 0 0 0 "231" "23"
"052216_CN_036" 2 0 0 0 0 0 0 "813" "8" 2 0 0 0 0 0 0 "413" "4"
"051316_CHV_112" 2 0 0 0 0 0 0 "612" "6" 2 0 0 0 0 0 0 "612" "6"
"053116_CN_024" 2 0 0 0 0 0 0 "113" "1" 2 0 0 0 0 0 0 "111" "1"
"051316_M_008" . . 999999999 999999999 999999999 999999999 999999999 "" "" . . 999999999 999999999 999999999 999999999 999999999 "" ""
"051316_CHV_027" 2 0 1 0 0 0 1 "611" "6" 2 0 0 0 0 0 0 "612" "6"
"040216_C13_041" 2 0 0 0 0 0 0 "1111" "11" 1 0 0 0 0 0 0 "231" "23"
"040816_C13_049" 2 0 0 0 0 0 0 "813" "8" 2 0 0 0 0 0 0 "813" "8"
"052216_D_049" 2 0 1 0 1 1 0 "418" "4" . . 999999999 999999999 999999999 999999999 999999999 "" ""
"041216_F_017" 2 0 0 0 0 0 0 "3811" "38" 2 0 0 0 0 0 0 "3811" "38"
"042116_M_114" 2 0 1 1 0 0 0 "512" "5" 1 2 1 0 1 0 0 "201" "20"
"052816_DK_079" 999999999 999999999 999999999 999999999 999999999 999999999 999999999 "N/A" "N/A" . . 999999999 999999999 999999999 999999999 999999999 "" ""
This is the code I used and the error I got:
. reshape long regul_@, hical_@, hisug_@, hisatfat_@, hisod_@,subcat_@, macrocat_@, prodsmallestcat_@, i(idspot) j(adprod)
invalid 'hisug_'
r(198);
end of do-file
r(198);
Any help will be much appreciated.
Best
Fernanda
Related Posts with Reshape long multiple variables error invalid "var" 198
MeologitQuestion: Do you know what might be the problem, and why stata does not recognizes apples as 10 gro…
How to estimate sample size for randomized control trial using simulation?We wanted to test the effect of community level sanitation intervention(CLS) integrated with nutriti…
Filling missing strings/categorical variables in panel data (long format)Hello I am finding a problem to clean my HIV related panel data. I would like to clean HIV status w…
Panel data analysis with AR(1)Hello everyone! I have a panel data for labor productivity for 74 countries for period of 1992-2016…
How to change xtline graphHi All! I have plotted a xtline graph for few entities. The observations between these entities ran…
Subscribe to:
Post Comments (Atom)
0 Response to Reshape long multiple variables error invalid "var" 198
Post a Comment