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]

st: RE: Bug with destring or operator error?


From   Joe Canner <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE: Bug with destring or operator error?
Date   Thu, 22 Aug 2013 18:09:48 +0000

__00001 sounds like Stata's internal designation of a temporary variable.

-destring- is an .ado file, so you can -set trace on- before the -destring- and see exactly where the problem is.  Let us know what you find and maybe we can dig around in the -destring- code and see what is causing it.

Regards,
Joe Canner


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Ben Hoen
Sent: Thursday, August 22, 2013 1:49 PM
To: [email protected]
Subject: st: Bug with destring or operator error?

Hi all,

I am having trouble with destring in an ado.  When I run the ado I get the following error:


. destring blkgrp, g(bgtemp) force
__000001 already defined
r(110);

end of do-file

r(110);

But after I get this error, if I just run the destring command again, it works fine:
. destring blkgrp, g(bgtemp) force
blkgrp contains nonnumeric characters; bgtemp generated as int
(44 missing values generated)


I have tried a number of different workarounds to keep the error from happening but to no avail.  Obvioulsy the point is to avoid manually coming and rerunning the second half of the ado.  Any ideas?  

Here is the full ado: 

*=============== START ==============
cd "B:\OtherDatabase\pv_prop_2\data\regest"
use bgreg.dta, clear //to call up the data g blkgrp=substr(parm,4,.) if substr(parm,1,3)=="pv_"  // the extract the number from the string destring blkgrp, replace force

/*
I also tried the following variations

With or without .replace blkgrp=trim(blkgrp) before destring

Instead use
destring blkgrp, g(bgtemp) force
drop blkgrp
rename bgtemp blkgrp
*/
*========== END ==============

Ben Hoen
Staff Research Associate
Lawrence Berkeley National Laboratory
Office: 845-758-1896
Cell: 718-812-7589
[email protected]
http://emp.lbl.gov/staff/ben-hoen

Visit our publications at: 
http://emp.lbl.gov/reports/re

Sign up for our email list to receive publication notifications at: 
https://spreadsheets.google.com/a/lbl.gov/spreadsheet/viewform?formkey=dGlFS
1U1NFlUNzQ1TlBHSzY2VGZuN1E6MQ






*
*   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