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
swilk test linear regressionHey guys, I did a linear regression analysis and checked for the normality assumption. The plot (qn…
Lost in the proces of matching dataHello everyone, I have learned a lot on the Statalist forum but I am not running into something tha…
Statistical Analysis with Control and treatment groupI would like some advice on what statistical analysis to use to test my hypothesis. I have two group…
Moving legend to empty space in GRAPH COMBINEDear members, I am trying to move the legends of some plots to an empty space in Code: GRAPH COMBI…
How to determine the number of lags in time seriesHi I am running the following model: Code: reg CSAD RtnMrktPort AbsRtnMrktPort SquDiffRtnMrktPort p…
Subscribe to:
Post Comments (Atom)
0 Response to egen concat including if function
Post a Comment