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 at the end of May, and its replacement, statalist.org is already up and running.


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

st: From: Richard Moverare <richard.moverare@gmail.com>


From   owner-statalist@hsphsun2.harvard.edu
To   statalist <statalist@hsphsun2.harvard.edu>
Subject   st: From: Richard Moverare <richard.moverare@gmail.com>
Date   Sun, 16 Jun 2013 20:16:13 +0200

Dear Statalist,

I have a small problem that I guess I should be able to solve, but I
got stuck. I have a string variable that consists of 1-3 numbers,
space, and then a description. The description varies in terms of
numer of words and characters.

What I would like to do is to create a numeric variable where the
values are the numbers in the beginning of the string and then use the
rest of the string as a value label. The dataset includes a number of
duplicates for this specific variable (one of the reason for doing
this conversion is to make the dataset smaller in size). The first
part is no problem using -word-, and I can get what I want as a label
by getting the second word and those that follow, but I got stuck
defining the labels for the variable.

The variables looks something like this:
234 Used cars, no batteries
22 Bottles - unspecifed
234 Used cars, no batteries
440 N/A
and so on.

Any help would be greatly appreciated!

All the best, Rick
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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