Dear Stata user, Suppose, I have a varibale named "price", which ranges from the 3291 (4 digits) to 15906 (5 digits). Now, I want to convert all observation in to five digits without changing the real value of observations, so i want to add one zero in left side of a observation if that observation is 4 digits. I have used the Stata data for example, so, please consider the following code to get the data,
sysuse auto.dta
sum price
sum price
Variable Obs Mean Std. Dev. Min Max
price 74 6165.257 2949.496 3291 15906
Related Posts with How to add zero before the observation in a variable?
tab year, gen(year_dummy)Dear All, In the following example Code: webuse grunfeld, clear tab year, gen(year_dummy) we can g…
How to count the values of a set of binary variablesHi there, I have a set of binary variables (n=17) for health conditions and each of them stands for…
reshape wide to longDear All, How can I reshpae the following wide data into long data format? Thanks. Code: * Example …
Create new variables based on condition and other variablesDear All, Can you please help me with the following: I have a data set which has the age (age_20) …
Creation of panel of 16 months by linking monthly samples from CPSMy main purpose is to see how a person changes job and how it affects the wage in few selective stat…
Subscribe to:
Post Comments (Atom)
0 Response to How to add zero before the observation in a variable?
Post a Comment