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

st: RE: reading numbes with trailing minus sign


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: reading numbes with trailing minus sign
Date   Wed, 23 Feb 2005 17:03:22 -0000

I would read this in  as a string and then 

replace y = substr(y,-1,1) + substr(y,1,length(y)-1) if substr(y,-1,1) == "-" 
destring y, replace 

Nick 
[email protected] 

David Kantor
 
> Suppose I have raw data where minus signs are in a trailing 
> position. Thus, 
> for example, instead of
> -12, you have
> 12-
> 
> Is there a direct way to read this?   Or is there a program 
> out there to 
> handle it?  I can write code to handle it, but I just wonder 
> if there is 
> anything I'm overlooking or if someone already has done it.

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