[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: quotes in a string variable
I can't see from here exactly what Stata
is holding as your string value.
It would seem that you have a dataset
on four-dimensional solids with
1 inch by 1 inch by 1/4 inch by 20 feet
That boggles the mind somewhat.
Whatever... it may be that you can
make progress with compound double
quotes `" "' as delimiters.
ge struct=0 if product == `"Angles 1"x1"x1/4"x20'"'
You have a long way to go before you can
-destring- such a variable, as it does not
seem to have an interpretation in terms
of single numeric values. You might be
better off starting with a -split-.
Alternatively, a direct attack with -egen, group() label-
might be least painful of all.
> I have to categorize a string variables which contains
> quotes. When I type the command
> ge struct=0 if product=="Angles 1"x1"x1/4"x20'"
> I get an error message because of the quotes.
> How can I get around it?
> Ideally, I would like to destring the variable. I
> know that the product is structural if the Angles are
> larger than 3x3x3/16, and if I could extract the
> dimensions, I could use that instead of going through
> every single product. The numbers are not always in
> the same position, and there is always the problem
> with the quotes. Any suggestion?
* For searches and help try: