Rike,
What do you mean by "it doesn't add a label for 0"? Stata can assign
labels to zeros. Did you forget the -modify- option?
. sysuse auto
. d foreign
storage display value
variable name type format label variable label
------------------------------------------------------------
foreign byte %8.0g origin Car type
. lab list origin
origin:
0 Domestic
1 Foreign
. lab def origin 0 "Rural", modify
. lab list origin
origin:
0 Rural
1 Foreign
. tab foreign
Car type | Freq. Percent Cum.
------------+-----------------------------------
Rural | 52 70.27 70.27
Foreign | 22 29.73 100.00
------------+-----------------------------------
Total | 74 100.00
Friedrich
On Mon, Mar 16, 2009 at 10:54 AM, Rike <[email protected]> wrote:
> Hi,
>
> I think the problem lies in the label. The variable "status"" takes 0
> for rural and 1 for urban, but I'm not able to assign a label to 0
> (and "urban" is already assigned to 1). I ran
>
> la def status 0 "rural"
>
> it doesn't add a label for 0 which is odd...
>
>
> On Mon, Mar 16, 2009 at 7:21 AM, Nick Cox <[email protected]> wrote:
>> No quotes are included in what you report here as typed.
>>
>> So, check out in turn
>>
>> 1. Any unmatched quotes in the variable label of -status-.
>>
>> 2. Any unmatched quotes in the value labels of -status- (if any).
>>
>> 3. Any unmatched quotes in the values of -status- (if it is a string
>> variable).
>>
>> 4. Repeat 1 for your other variables.
>>
>> My guess is #1.
>>
>> Then remove the unmatched quote _or_ insert a matching quote and reissue
>> the -graph- command.
>>
>> Nick
>> [email protected]
>>
>> Rike
>>
>> I tried it without the space (I mistakenly put it back there when I
>> copied the code for the list) but I get the same error. Any other
>> ideas?
>>
>> Kieran McCaul
>>
>>> You have a space in the -by- option.
>>> -by (status)- should be -by(status)-
>>
>> Rike
>>
>>> I'm running the following code:
>>>
>>> twoway scatter ratio month, by(status) c(l) xlabel(1(1)12)
>>>
>>> twoway scatter ratio1 ratio2 ratio3 ratio4 month, by (status)
>>> connect(l l l l) xlabel(1(1)12)
>>>
>>> where status is a dummy. Stata returns an r(198) error, and it
>>> happened when I added the by-option. I would also like to use
>>> by(status, total) later on. Any suggestions? Thanks in advance.
*
* 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/