Dear statalists,
I am currently working to extract specific variables from the British Househould Panel Survey (BHPS) to create a personalised dataset. Following the guidelines in an online manual (https://www.understandingsociety.ac....ta-version.pdf), I run the following code:
foreach w in h i j k l m n o p q r {
use `w'j1cssf `w'hid `w'j1rgsc `w'j1sec `w'j1seg `w'j1soc_cc `w'j1none using `w'indresp, clear
renpfix `w'
gen wave = strpos("abcdefghijklmnopqr","`w'")
sort hid
save $dir3/wavehon`w', replace
}
STATA produced the following output:
invalid 'h'
r(198);
I can't quite figure out what the problem is, as I don't think I specified a variable called "h" in my code.
Thank you very much in advance to anyone who will spend their time answering my question!
Related Posts with invalid 'h' r(198) error in foreach loop
Metan forest plot x-axis legend insertion - how?Hi all, can anyone help me with this? Trying to label the two sides of the x-axis with "Favours con…
-gllamm- for dynamic multinomial logit model with random effectsDear all, I am working on household survey panel data (3 waves) to analyse the dynamic between 4 sta…
Graph bar -Hi everyone, I'm making a graph for a variable with three categories that resembles the following: …
bsample result not robust after innocuous data manipulation?Hi Stata users, Currently I found the bsample is not returning robust results after some seemingly …
Graph bar - Centering one graph when using -by()-Hi everyone, I'm making a graph for a variable with three categories that resembles the following: …
Subscribe to:
Post Comments (Atom)
0 Response to invalid 'h' r(198) error in foreach loop
Post a Comment