Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

RE: st: only keep obs of determinate string length


From   "[email protected]" <[email protected]>
To   <[email protected]>
Subject   RE: st: only keep obs of determinate string length
Date   Wed, 30 Jan 2013 09:51:52 -0800 (PST)

keep if length(id)==11 | length(id)==12

Sent with Verizon Mobile Email


---Original Message---
From: [email protected]
Sent: 1/30/2013 12:49 pm
To: [email protected]
Subject: st: only keep obs of determinate string length

Hello all,

I'm drawing a blank on what should be a ridiculously easy problem.

I have a unique string id var. Values in this var vary from 8-16 characters in length. I only want to keep obs where the length of the id string is either 11 or 12 characters long. I know I can solve this in a more cumbersome manner using the -regex- machinery, but I was hoping for a more succinct solution using string functions. Unfortunately, I'm having a mental block with choosing the appropriate function. Suggestions would be appreciated.

Thanks,
Steve


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index