I have a very simple issue, and I read some help material but can't quite solve it.
I want to create some new IDs identifiers combining the session number and the session IDs of my experiment. However, I want these new IDs to have the same number of digits. So the result should be as follows:
session session_ID new_ID
1 1 101
1 2 102
...
1 10 110
1 11 111
...
2 1 201
2 2 202
...
2 10 210
2 11 211
...
If I used Excel, the code would be new_ID = concatenate(session; if(length(session_ID)=1;"0";"");session_ID)
How can this be done in Stata?
Thanks in advance for your help!
gianluca
Related Posts with egen concat including if function
Logit ModelHello, Which estimator does a logit model use when we do not specify the type of estimator in a log…
Extract Year from a string variableHi everyone, I would like to ask some help in order to extract year from a string variable (year of …
FD-GMM vs sys-GMMDear all. Which kind of GMM method should I use to dynamic panel data? FD-GMM or sys GMM?Some people…
Stacked graph bar with marginsplot ?Good morning everyone! I need your help for plotting the results of margins in a nice and straightf…
how to access STATA 16 sever through MAC terminalCurrently, I successfullly installed Stata on my server and can use "./stata" to initiate the progra…
Subscribe to:
Post Comments (Atom)
0 Response to egen concat including if function
Post a Comment