Hi there,
In my databank, I have a variable that tells me about a departure time (the variable is named hredep). The data is written like this: hhmm [h for hour, m for minutes).
So, for a departure time of 14:45, my data given in hredep is 1445.
I need to create a new variable that separate the last two digits, so I could obtain only the minutes. So in my exemple above I would have the data 45.
How can i do this? And what if I want the hour, so the first the numbers instead?
Thank you very much!
Maxime
Related Posts with Generate a new variables, with the last two numbers of another variable
The choice of selection equation in the Heckman procedureMy sample includes only migrants that send remittances and non migrants. I am trying to predict the …
missing coefficient and standard error when using areg commandHi everyone, I have a data set that I included here. I try to run the regression to find the effect…
Loop over several files in a directory and save each dataset in a new .dtaHello. I would like to repeat do-files for several datasets in a directory. I like to include such a…
Sample Distribution by YearsDear Statalists, I have an unbalanced panel sample and want to create a table summarizing firms dis…
Renaming multiple variables in a loopHi, How can I rename multiple variables without having to manually rename every single one of them …
Subscribe to:
Post Comments (Atom)
0 Response to Generate a new variables, with the last two numbers of another variable
Post a Comment