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
Cubic splines to model relationships between continuous variables and outcomes: a guide for cliniciansFor those interested, I've just come across this interesting article, published on Bone Marrow Trans…
Conditional probability after eprobitDear all, I am using eprobit in Stata 15 to estimate a probit regression with endogenous sample sel…
Generating a dummy variable with value from other variable to a new row (cell)Hi, my job here is to generate a new variable (dummy for months unemployed) for December. In my anal…
Color schemes and color palettes - setting default colors for graphsI have a list of colors from my workplace that we should use for all the graphs I create. Ideally I …
I am confused about the confidence interval of survival analysis between two methodsIf I analyze a set of data use syntax ”ci means variate” and I get a result like this ci means y V…
Subscribe to:
Post Comments (Atom)
0 Response to Removing the intermediate 0 from string variable
Post a Comment