Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: creating new id variable
From
A Muhyidin <[email protected]>
To
[email protected]
Subject
st: creating new id variable
Date
Tue, 28 Aug 2012 11:08:12 +0900
Dear Statalisters,
I am trying to make a new id based on the two previous id, but so far
without any luck.
The new id that I'd like to make should be 4 digits, 2 digits from id1
and and 2 digits from id2.
If id2 consists of 1 digit number, I would like to add zero before the
last number to make new_id as 4 digits.
Any help would be appreciated.
| id1 id2| new_id
|------------|
1. | 11 1 | 1101
2. | 11 5 | 1105
3. | 11 8 | 1108
4. | 11 9 | 1109
5. | 11 10 | 1110
|------------|
6. | 11 14 | 1114
7. | 11 15 | 1115
8. | 11 16 | 1116
9. | 11 17 | 1117
10. | 11 18 | 1118
+------------+
Thanks.
Best,
A Muhyidin
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/