Hello,
How can I keep observations that start with a certain set of numbers. Specifically, I want to keep observations that start with "3344" within a list of mostly 6-digit numbers. I found a previous post (http://www.stata.com/statalist/archi.../msg01191.html) but for some reason these options aren't working. I've tried the following but stata says I’m using invalid syntax.
keep if substr(string(naics02), 1, 2, 3, 4) == "3344"
I then tried using floor but it dropped all of my data (when in fact there are observations that start with 3344):
keep if floor(naics02/10000) == 3344
Please help! Thank you!
Alyse
How can I keep observations that start with a certain set of numbers. Specifically, I want to keep observations that start with "3344" within a list of mostly 6-digit numbers. I found a previous post (http://www.stata.com/statalist/archi.../msg01191.html) but for some reason these options aren't working. I've tried the following but stata says I’m using invalid syntax.
keep if substr(string(naics02), 1, 2, 3, 4) == "3344"
I then tried using floor but it dropped all of my data (when in fact there are observations that start with 3344):
keep if floor(naics02/10000) == 3344
Please help! Thank you!
Alyse