<>
*************
clear*
input str10 var1
K04945
end
*
generate left=substr(var1, 1,2)
generate middle=0
generate right= substr(var1, 3,.)
egen new=concat( left middle right)
drop left middle right
list
*************
HTH
Martin
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Polis, Chelsea
B.
Gesendet: Mittwoch, 4. Februar 2009 14:54
An: [email protected]
Betreff: st: Inserting a number into existing study ids
Dear Statalisters,
I need to insert a zero between the first and second characters in a column
of study IDs. For example, K04945 must become K004945. Any clues on how to
achieve this?
Many thanks!
Chelsea
*
* 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/
*
* 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/