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: Bug with destring or operator error?


From   "Ben Hoen" <[email protected]>
To   <[email protected]>
Subject   st: Bug with destring or operator error?
Date   Thu, 22 Aug 2013 13:48:51 -0400

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/


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