Hi,
I've got a string variable, which should have 10 characters.
I need to add a "0" in the front of the string but only if the string is 9 characters long.
ex.
Var 1
0123456789
123456789
0123456789
I'm using replace var1= "0" + var1 but missing the part where I can depend the command to only occure if the string is 9 characters.
Any help is very much appreciated
Best
Charlotte
Related Posts with Adding character to string variable depending on the length of characters in the same string
Basic sum questionHello, I am new to stata and I need to calculate the gross value added in the entire year 2020 (both…
Thresholds displayed on ROC CurveI'm graphing a binary variable on a 7-category variable, and I'd like the 7 categories to be labeled…
Monte Carlo - Simulations: random samples, record meansHello, I have a dataset with the variable "LeadLevels" (continuous numerical variable, cannot be a …
nl with inequality constraints lead to bad local optima, with fixStataCorp has a helpful FAQ, How do I fit a linear regression with interval (inequality) constraints…
nl with inequality constraints lead to bad local optima, with fixStataCorp has a helpful FAQ, How do I fit a linear regression with interval (inequality) constraints…
Subscribe to:
Post Comments (Atom)
0 Response to Adding character to string variable depending on the length of characters in the same string
Post a Comment