Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: AW: Changing the ID


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: Changing the ID
Date   Wed, 14 Oct 2009 11:57:51 +0200

<> 

I bet there is an easier way to do this...


*************
clear*

input  str10 id   
1A01506006
10015021903
10015012502
100150122013
1001505901
10015020502
10015026104
10015014402
1A015018102
1001506704
10015026601
10015028107
1001507004
1A01508604
end

compress

replace id= /* 
*/ substr( id,1,1)+"0"+ /* 
*/ substr(id,3,.)  /* 
*/ if strpos( id, "A")==2


list, noobs
*************



HTH
Martin

-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Rajaram
Subramanian Potty
Gesendet: Mittwoch, 14. Oktober 2009 11:51
An: [email protected]
Betreff: st: Changing the ID

Dear all,

I have a data set which contains IDs of individual cases. But
unfortunately some of the IDs include character "A", (either in
capital or small). Instead of the value "0" for some of the cases "A"
is included. I just want to know how, I should remove "A" and put "0".
Following is the example of the IDs of 14 observations.

1A01506006
10015021903
10015012502
100150122013
1001505901
10015020502
10015026104
10015014402
1A015018102
1001506704
10015026601
10015028107
1001507004
1A01508604

Thanks and regards,

RAJARAM. S
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index