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: Problem with creating new ID with other ID variables
From
nola l <[email protected]>
To
[email protected]
Subject
st: Problem with creating new ID with other ID variables
Date
Mon, 10 Jun 2013 12:37:07 -0400
Hello,
I have a data set like below:
+------------------------------------+
| h1aq1 h1aq2 h1aq3 h1aq4 EA |
|------------------------------------|
1. | 101 2 4 2 2 |
2. | 101 2 4 2 2 |
3. | 102 . . . . |
4. | 101 2 4 2 2 |
5. | 101 2 4 2 2 |
|------------------------------------|
6. | 106 . . . . |
7. | 102 1 1 4 1 |
8. | 102 1 1 4 1 |
9. | 102 1 1 4 1 |
10. | 102 1 1 4 1 |
|------------------------------------|
11. | 102 1 1 4 1 |
12. | 102 1 1 4 1 |
13. | 102 1 1 8 2 |
14. | 102 1 1 8 2 |
15. | 102 1 1 8 2 |
and I would like to generate a ID which should looks like
CID=EA+ h1aq4*100+ h1aq3*10000+ h1aq2*1000000+ h1aq1*100000000
which means that CID for record 1 is 10102040202.
When I use following command in Stata12:
gen CID=EA+ h1aq4*100+ h1aq3*10000+ h1aq2*1000000+ h1aq1*100000000
format %16.0g CID
I got CID=10102040576 for record 1.
Where did I mess up? Could you guys help me out on this and tell me
how to could create correct ID?
Thanks,
Nola
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/