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
Omitted Interactions in Negative Binomial Panel RegressionHello, I ran into some trouble when introducing interaction effects in my model. To quickly explain…
Problem with weight use and specific commandsDear Statalists, I am aware that I am creating an unconvential and unusual post, and apologize in a…
Using joinby to combine monthly and yearly panel datasetsHi everybody I have a quick (maby redundant) question about joinby. I have many different panel dat…
MatchingDear all, I am getting new with matching firms. The objective of my analysis is to perform a Diffin…
Trajectory analysis - keep registry_HbA1c if date_of_HbA1c_test > 1 year after baseline_HbA1c for each ID_numberDear Stata experts, I am really stuck. In my data set, I have variables for the participant's ID nu…
Subscribe to:
Post Comments (Atom)
0 Response to obtaining the first three digits
Post a Comment