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
xtreg adjusted for heteroskedasticiy and firm-level clusteringHello, I have unbalanced panel data (74 companies with a total of 800 observations over 18 years). …
graph editingI created the attached data file from data on the web. I typed:: hbar pctdiff,l(name) using Nick C…
Wrong observation number and cluster numberHi, I am currently puzzled by having a different observation and cluster count in the regression mo…
Propensity Score Matching Panel DataHello, I am looking to analyse the change (if any) in the political opinion of an individual after t…
I am trying to make something like -levelsof- saving the levels of a variable, but not in a local, rather in a another variable.Good morning, I often use -levelsof- to loop through the levels of an unequally spaced variable. It…
Subscribe to:
Post Comments (Atom)
0 Response to Reshape long multiple variables error invalid "var" 198
Post a Comment