Statalist


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

st: how to count the number of certain characters in a string variable?


From   gjhxmu@sina.com
To   statalist<statalist@hsphsun2.harvard.edu>
Subject   st: how to count the number of certain characters in a string variable?
Date   Tue, 28 Jul 2009 22:05:43 +0800

Dear statalists,

I have a string variable X as follows:

X                Y

aabb            2

bbdd            0

cdba            1

dxbaa          2

dxaa            2

I want to generate a variable Y to stand for the number of certain characters, 
such as "aa" and replace these characters with other characters, such as "zz".


How to do it ?

Thank you !

Sincerely,




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