Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Invalid Label Error

    The second half of my code is producing an error stating "varlist not allowed".

    I am working on a dataset from an experiment that looked at how male and female students and faculty responded to an email. I have to create bar graphs using the coefplot command comparing the results by gender for students and faculty. When I input the command in my dofile, Stata states varlist not allowed. Is there something I am doing wrong with the code?

    I have included sample of my dataset, code, and the Stata output.

    Any help is appreciated thank you.
    Attached Files

  • #2
    This is in effect a bump of https://www.statalist.org/forums/for...efplot-command

    Since joining yesterday you have started three threads, which overlap mightily.

    In your first thread https://www.statalist.org/forums/for...ssion-commands you got excellent advice from Clyde Schechter , which still stands:

    Please read the Forum FAQ, with special attention to #12 on the best ways to give data, code, etc. In particular, attachments are discouraged.
    You are still attaching images. This is a good idea only for graphs, which are not yet relevant to your questions. This is explained at FAQ Advice #12.

    The data example here is in an image. In practice no-one wants to try to convert an image to the data it shows.

    The same applies to your code. People answering questions on difficult code usually want to copy and paste it, which isn't possible with code in any image.

    I am not familiar with coefplot (SSC, as you are asked to explain), a great command I have never used, but my guess is that not following forum advice is cutting down on the number of readers willing even to tackle your question.

    For advice on bumping, please see https://www.statalist.org/forums/help#adviceextras #1.

    Comment


    • #3
      Thank you for the information. Here is the code, excerpt of the data, and the copy of the error.

      [CODE]
      tabulate gender, generate(gender)
      set more off
      foreach var of varlist opened_first clicked_first clicked Totalclick survey {
      forvalues i=0(1)1 {
      di "FEMALE `var'"
      reg `var' social_treatment if gender1==1 & social_treatment_student==`i'
      estimates store gender1`i'
      di "MALE `var'"
      reg `var' social_treatment if gender2==1 & social_treatment_student==`i'
      estimates store gender2`i'
      }
      }

      *set scheme s2mono
      set scheme s2color
      coefplot((_est_gender2`0', label(Business) (_est_gender`1' , label(Social), bylabel(FEMALE)) ///
      (_est_gender2`0', label(Business) (_est_gender2`1', label(Social), bylabel(MALE) ///
      vertial recast(bar) barwidth(0.3) fcolor(*.5) ///
      ciopts(recast(recap) citop levels(90 95) ///
      xlabel(none))

      }
      end
      [\CODE]

      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input byte social_treatment float(opened opened_first) str1 gender float clicked_first byte Totalclicks float survey
      1 0 0 "F" 0 0 0
      1 0 0 "F" 0 0 0
      1 0 0 "F" 0 0 0
      0 0 0 "F" 0 0 0
      0 1 1 "F" 0 0 0
      0 1 0 "F" 0 0 0
      1 1 1 "F" 0 0 0
      1 0 0 "F" 0 0 0
      1 1 1 "F" 0 0 0
      1 0 0 "F" 0 0 0
      0 0 0 "F" 0 0 0
      0 0 0 "F" 0 0 0
      0 1 0 "F" 0 0 0
      1 0 0 "F" 0 0 0
      1 1 1 "F" 0 0 0
      1 1 1 "F" 0 0 0
      1 1 0 "F" 0 0 0
      0 0 0 "F" 0 0 0
      0 1 0 "F" 0 0 0
      0 1 1 "F" 0 0 0
      0 0 0 "F" 0 0 0
      1 0 0 "F" 0 0 0
      1 0 0 "F" 0 0 0
      1 0 0 "F" 0 0 0
      1 0 0 "F" 0 0 0
      1 0 0 "F" 0 0 0
      1 1 1 "F" 0 0 0
      1 0 0 "F" 0 0 0
      0 1 1 "F" 0 0 0
      0 1 0 "F" 0 0 0
      0 0 0 "F" 0 0 0
      0 1 1 "F" 0 0 0
      0 0 0 "F" 0 0 0
      0 0 0 "F" 0 0 0
      1 1 1 "M" 1 1 0
      1 0 0 "M" 0 0 0
      1 1 1 "M" 1 2 0
      1 0 0 "M" 0 0 0
      1 0 0 "M" 0 0 0
      1 1 0 "M" 0 0 0
      1 0 0 "M" 0 0 0
      1 1 1 "M" 0 0 0
      0 1 1 "M" 0 0 0
      0 1 1 "M" 0 0 0
      0 0 0 "M" 0 0 0
      0 0 0 "M" 0 0 0
      0 1 1 "M" 0 0 0
      0 1 1 "M" 0 0 0
      0 0 0 "M" 0 0 0
      0 1 1 "M" 0 0 0
      1 1 1 "M" 0 0 0
      0 1 1 "M" 0 0 0
      1 0 0 "M" 0 0 0
      1 1 1 "M" 0 0 0
      1 0 0 "M" 0 0 0
      1 0 0 "M" 0 0 0
      0 0 0 "M" 0 0 0
      0 0 0 "M" 0 0 0
      0 1 0 "M" 0 0 0
      0 1 1 "M" 0 0 0
      1 0 0 "M" 0 0 0
      1 0 0 "M" 0 0 0
      1 1 1 "M" 0 0 0
      1 1 1 "M" 0 0 0
      1 0 0 "M" 0 0 0
      1 0 0 "M" 0 0 0
      1 0 0 "M" 0 0 0
      0 0 0 "M" 0 0 0
      0 0 0 "M" 0 0 0
      0 1 1 "M" 0 0 0
      0 0 0 "M" 0 0 0
      0 0 0 "M" 0 0 0
      0 0 0 "M" 0 0 0
      0 0 0 "M" 0 0 0
      1 0 0 "F" 0 0 0
      1 1 1 "F" 0 0 0
      1 1 1 "F" 0 0 0
      1 1 1 "F" 0 0 0
      1 1 1 "F" 0 0 0
      0 1 1 "F" 0 0 0
      0 1 0 "F" 0 1 1
      0 1 1 "F" 0 0 0
      0 1 1 "F" 0 0 0
      0 1 0 "F" 0 0 0
      1 1 1 "F" 0 0 0
      1 1 1 "F" 0 0 0
      1 1 1 "F" 0 0 0
      0 0 0 "F" 0 0 0
      0 1 0 "F" 0 0 0
      0 1 1 "F" 0 0 0
      0 1 1 "F" 0 0 0
      1 1 1 "F" 0 0 0
      0 1 1 "F" 0 0 0
      0 1 0 "F" 0 0 0
      1 1 0 "F" 0 0 0
      1 1 1 "F" 0 0 0
      1 0 0 "F" 0 0 0
      1 1 1 "F" 0 0 0
      0 1 1 "F" 0 0 0
      0 1 1 "F" 0 0 0
      end

      Comment


      • #4
        Thanks for the extra details. Your code fails on the example because there is no variable social_treatment_student in the example.

        Beyond that, perhaps you can explain what you think should happen with references to

        Code:
        _est_gender2`0'      
        
        _est_gender`1' 
        
        _est_gender2`0'
        
        _est_gender2`1',
        They look wrong, as the local macros 0 and 1 are not obviously defined and you worked on variables gender1 and gender2.

        Beyond that

        Code:
        vertial
        is presumably a typo for
        Code:
        vertical
        But that doesn't find your error. Your use of parentheses doesn't look consistent, but I can't be confident where they should go.

        As said, I have not used this command and can't suggest more, but your example and code that can be copied push the thread a little further.

        Others who have used it may be able to help more.

        Comment

        Working...
        X