Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Egen ends behavior apparently violates rules in documentation


From   Devra Golbe <[email protected]>
To   [email protected]
Subject   st: Egen ends behavior apparently violates rules in documentation
Date   Wed, 15 Jan 2003 12:06:09 -0500

Hi,

the following code fragment suggests that egen ends does not operate as the documentation (pasted at the bottom of my message) suggests. Specifically, with the tail option, if no punct(pchars) appears, the tail should be empty. However, my output suggests that under these circumstances (no appearance of pchars) the tail contains the entire "word".

Thanks in advance for your insights.

Devra

*******
. which egen
C:\STATA7\ado\updates\e\egen.ado
*! version 3.3.2 07may2001


. egen consid1=ends(consid), punct(*) head;

. egen considt=ends(consid), punct(*) tail;

. egen consid2=ends(considt), punct(*) head;

. egen considt2=ends(considt), punct(*) tail;

. list consid consid1 consid2 considt2 in 1/10;

consid consid1 consid2 considt2
1. CASH*NOTE*LIA CASH NOTE LIA
2. CASH CASH CASH CASH
3. CASH CASH CASH CASH

*******



ends(strvar) [, punct(pchars) trim [head|tail|last]]
may not be combined with by. It gives the first "word" or head (with the head option), last
"word" (with the last option), or the remainder or tail (with the tail option) from string
variable strvar.

head, last and tail are determined by the occurrence of pchars, which is by default a single
space " ".

[snip]

The remainder or tail is whatever follows the first occurrence of pchars, which will be the empty
string "" if it does not occur. The tail of "frog toad newt" is "toad newt" and of "frog" is "".
With punct(,), the tail of "frog,toad" is "toad".



_____________________________________________
Devra L. Golbe , Professor
Department of Economics
Hunter College
695 Park Ave., NY, NY 10021
voice: 212-772-5408
fax: 212-772-5398
e-fax: 208-361-5964

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* 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