Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Getting rid of units in string variable

From   "Kanter, Rebecca" <>
To   "" <>
Subject   st: Getting rid of units in string variable
Date   Sat, 18 Sep 2010 16:41:14 -0400


I am in the process of converting string variables to numeric (e.g. weight values), but many have the units entered with the numeric value...

For example,

Is there an easier way to get rid of the "kg??" 
Than to have to do:
replace  var = "101.36" if var == "101.36kg" (for every entry with units attached)

Thanks so much,

Rebecca M. Kanter
PhD Candidate
Johns Hopkins Bloomberg School of Public Health
Department of International Health
Center for Human Nutrition
*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index