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: RE: left right string


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: left right string
Date   Tue, 18 May 2010 23:08:38 +0200

<>


You can generate the new variables and -destring- (which I assume you also
want) in one fell swoop:


***********
clear*

inp str5 hhh_age
15-19
20-24
25-39 
end

split hhh_age, gen(age) parse(-) destring
rename age1 age_min
rename age2 age_max

list, noo
***********


HTH
Martin


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Martin Weiss
Sent: Dienstag, 18. Mai 2010 23:05
To: [email protected]
Subject: st: RE: left right string


<>

Have you had a look at -split-?


HTH
Martin

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Tyler Frazier
Sent: Dienstag, 18. Mai 2010 23:03
To: [email protected]
Subject: st: left right string

simple question, I hope -- I have a variable which is a range of ages,
for example  the variable name is hhh_age and the quantities are
15-19, 20-24, 25-39 etc...

and I want to generate a new variable (age_min) that returns the left
two characters from hhh_age , and another variable that generates the
right two -- (age_max)

I searched but couldnt find it, seems like a very simple thing, but
cant figure it out.

any help is greatly appreciated

Ty
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/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/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/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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