> I'm currently looking for some help generating a new variable that is a
> count of the number of commas in string variable in my data set.
>
> Conor
You can combine -length( )- and -subinstr( )- functions.
gen comma = length(trim(var1))-length(trim(subinstr(var1,",","",.)))
where var1 is the variable of interest.
Roy
_________________________________________________________________
Hotmail® has ever-growing storage! Don’t worry about storage limits.
http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage_062009
*
* 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/