Announcement

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

  • String Dummy-like Variable

    Hello all,

    I have two variables, one is called cp_flag (a string variable), that serves as a sort of dummy variable that can only take two values: "C" or "P". I also have another variable called ret, that is a numeric variable. I would like to find the sum of the numeric variable ret, but only when cp_flag is equal to "P". Those anyone know how to do this?

    Thanks

  • #2
    Could be

    Code:
    summarize ret if cp_flag == "P", meanonly 
    display r(sum)
    although I can guess at other interpretations of your question.

    Comment


    • #3
      Yes thank you Nick that works!

      Comment

      Working...
      X