Statalist


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

st: AW: Count special characters


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
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: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Andrea Rispoli
Gesendet: Donnerstag, 17. September 2009 12:16
An: statalist@hsphsun2.harvard.edu
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index