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
How do combine (append) multiple rtf files in the current working directory from within Stata?I have multiple rtf files in my current working directory (produced using Ben Jann's -estout- (on SS…
Recode many different observations in one variable.Hi, I am analyzing municipalities in Sweden and my data consists of 290 different municipalities. In…
Creating PercentilesHi, I have 3,691 observations and I want to create income percentiles for them. However, whenever I…
Sorting and Labelling coeffecient from different models using coefplot.Hello Stata family! My data is divided into 10 equal groups by a categorical variable called decile…
Comparing the Explanatory power of two regression modelsI would like to compare two models with each other. However, these two models have different sample …
Subscribe to:
Post Comments (Atom)
0 Response to obtaining the first three digits
Post a Comment