Hi All,
I have 10 different variables with the word "date" in their name. The names have two parts, word "date" and a unique part.But the order of these two parts is different. For example, dateinposition and hiredate. I want to split all of these dates into their year, month, and day and make the new variables' names to the unique part+year, unique part+month, and uniquepart+day
All these variables are string and in yyyy-mm-dd format.
My new variables would be:
inpositionyear inpositionmonth inpositionday hireyear hiremonth hireday
I know how to use split command for one variable, but I don't know how to use a loop for all variables when the names have different formats.
I really appreciate your help.
I have 10 different variables with the word "date" in their name. The names have two parts, word "date" and a unique part.But the order of these two parts is different. For example, dateinposition and hiredate. I want to split all of these dates into their year, month, and day and make the new variables' names to the unique part+year, unique part+month, and uniquepart+day
All these variables are string and in yyyy-mm-dd format.
My new variables would be:
inpositionyear inpositionmonth inpositionday hireyear hiremonth hireday
I know how to use split command for one variable, but I don't know how to use a loop for all variables when the names have different formats.
I really appreciate your help.
Comment