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

Re: st: RE: reading numbes with trailing minus sign


From   David Kantor <[email protected]>
To   [email protected]
Subject   Re: st: RE: reading numbes with trailing minus sign
Date   Wed, 23 Feb 2005 12:22:04 -0500

Nick,
Thanks very much. That's roughly what I was doing, except I had forgotten about the
substr(y,-1,1) construct.

-- David

At 05:03 PM 2/23/2005 +0000, Nick Cox wrote:

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-
[...]
David Kantor
Institute for Policy Studies
Johns Hopkins University
[email protected]
410-516-5404
*
*   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