I have naics codes that have six digits, and I want to get the first three digits in each of them and form a new variable named three_digits
I tried using the "gen threedigit=int(Naics_1/1000)" (this gave me a list of zeros in the newly generated variable)
Looking at answers to similar posts, I used "gen three_digit=substr(naics, 1,2,3)" and it was an Invalid Syntax
Thank you.
Related Posts with obtaining the first three digits
Estimating the modified Jones model by industry and year using panel dataHi all. I'm studying the relationship between restatements and firms' earnings management behaviour.…
Imputing missing state-years using average of surrounding yearsHello, I have a state-year panel dataset, which is mostly balanced except for one missing year in W…
Combined new variable: code MV from other variablesI would like to create a variable in which I code 1 if a certain threshold in several other indicato…
All Dates on Data Editor Coming Up as .Hello! Currently new to operating STATA. My Data Editor does not show any dates despite me having d…
How can I use pweight by hand?Dear statalists: I want to use a mirco sampling data in R,but the package used in R is systemfit whi…
Subscribe to:
Post Comments (Atom)
0 Response to obtaining the first three digits
Post a Comment