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

Re: st: isolating characters in the middle of a long number


From   David Kantor <[email protected]>
To   [email protected]
Subject   Re: st: isolating characters in the middle of a long number
Date   Tue, 31 Aug 2004 18:57:39 -0400

Try this (untested):

gen byte newvar = mod(int(oldvar/10000), 100)

I hope this helps.
--David

At 06:13 PM 8/31/2004 -0400, you wrote:
Numeric, I believe.

Thanks,
Kenley

----- Original Message -----
From: David Kantor <[email protected]>
Date: Tuesday, August 31, 2004 5:57 pm
Subject: Re: st: isolating characters in the middle of a long number

> This is not hard, but first tell us whether the type of original
> value is string or numeric.
>
> At 05:21 PM 8/31/2004 -0400, you wrote:
> >I have a variable that is a number of about 10 characters, and I
> need to
> >create a variable that is the 5th and 6th character of the longer
> >variable. Does anyone have any suggestions on how I could do this?
> >
> >Thank you very much for your help.
> >
> >Kenley
> >[...]

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