Hey everyone,
I have a string variable 'p2' that consists of ID codes formatted as follows "BBSC0123" "BBSC01010", I am trying to remove the 0 directly following the letters, but not remove any 0 that might be in the last 4 digits of the code?
I am relatively new to stata and have tried:
. gen p4 = substr(p2, 6, 4)
and
. gen p4 = substr(p2, 1, 4)
(only want to keep the 1-4 and 6-9 digits?) But can't workout how to do one that keeps either side of the 0
Related Posts with Removing the intermediate 0 from string variable
Error rdplotI have a problem regarding a regression discontinuity design. I use panel data, where I have two yea…
Estimating p-value from t-value in regression with cluster-robust standard errorsHi, I have run a regression model with cluster-robust standard errors, using the following command:…
Drop many variables with same answer in the observationsHi, I'm working with a database from a University. In the observations there are a lot of variables …
Random Effects vs Fixed Effects model issues with Hausman Test (V_b Vb not positive definite)Dear Statalister, I have an unbalanced panel dataset for 5817 (N) firms per 8 years (T). I'm runnin…
Problem with summarystatistics by groupDear all, In my dataset I have 5 dummies, indicating whether a firm belongs to a specific group. I …
Subscribe to:
Post Comments (Atom)
0 Response to Removing the intermediate 0 from string variable
Post a Comment