Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, is already up and running.

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

Re: st: Extracting numbers from code

From   "" <>
Subject   Re: st: Extracting numbers from code
Date   Tue, 13 Nov 2012 14:47:58 -0500

Hi Daniel.

Thank you again for the code. That really helps a lot!
What I have found today, is an error that I am not sure why it occurs
or how to solve it.
While the first part of the code:

g byte dummy1 = (substr(strofreal(a5_bc), 1, 1) == "1") & ///
(cond((strlen(strofreal(a5_bc)) < 5),
cond(!(inlist(substr(strofreal(a5_bc), 2, 1)), "0", "1"), 1, 0), 1))

works very well,
the second part is causing some problems

forv j = 2/11 {
    g byte dummy`j' = (strpos(strofreal(a5_bc), "`j'") > 0)

The dummies are all correctly created, until the variable a5_bc has
more than 8 numbers. For example:
12347911 is classified under dummies 1,2,3 and 7, but not under
dummies 4, 9 and 11, as it should.
1234568910 is the longest entry I have and that also is not classified
Is there possibly a restriction to the length of the variable?

Kind regards
*   For searches and help try:

© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index