Hi all,
My data:
I would like to run the following code:
However I get the error:
3* invalid name.
In the following post: https://stackoverflow.com/questions/...n-if-statement, the following was written by Nick Cox: "To answer your underlying question, wildcards are not allowed in if qualifiers (the case here) or if statements."
Therefore, I wondered whether there exists a way or circumventing the fact that wildcards are forbidden in if statements, by telling Stata to
for all combinations of ONETSOCCCODE and NaicsCode that start with the specified prefixes.
Any ideas?
Many thanks in advance!
Maxence Morlet
My data:
Code:
input long ONETSOCCODE str6 NaicsCode 57-0000 "238210" 78-0004 "611519" 54-0475 "238160" 45-6598 "238350" 32-1000 "237130" 87-0495 "236118" 46-7600 "922140" 54-8905 "238220"
Code:
g treated=0 replace treated=1 if inlist(ONETSOCCCODE,17-*,49-*,51-*,15-11*,13-*,27-1*,27-3*) | inlist(NaicsCode,"31*","32*","33*","54*","51*")
3* invalid name.
In the following post: https://stackoverflow.com/questions/...n-if-statement, the following was written by Nick Cox: "To answer your underlying question, wildcards are not allowed in if qualifiers (the case here) or if statements."
Therefore, I wondered whether there exists a way or circumventing the fact that wildcards are forbidden in if statements, by telling Stata to
Code:
replace treated=1
Any ideas?
Many thanks in advance!
Maxence Morlet
Comment