Statalist


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

st: AW: Count special characters


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: Count special characters
Date   Thu, 17 Sep 2009 12:54:51 +0200

<> 

I take "cell" to denote an observation of a -string- variable... Install
Nick`s -ssc inst egenmore- and:


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

input str30 mystr
"first st|r|"
"se|cond str|ing"
"third string"
"fou||rth|  strin|g"
end

compress

egen numberofocc= /* 
*/  noccur(mystr) , string(|) 

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



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Andrea Rispoli
Gesendet: Donnerstag, 17. September 2009 12:16
An: [email protected]
Betreff: st: Count special characters

Dear Statalisters,
is there a command that I can use to count the number of "|" in a cell?
Thank you very much.
AR
*
*   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