user2817259
user2817259

Reputation: 21

If-command in Stata 11

The variable variable_1 ranges from 0 to 10 plus a 99 for missing values. I want to do a stata calculation using only the values from 0 to 10 but the if command doesn't seem to work. The sum command result states 99 as the max value. How can I select all the values that are not 99?

if variable_1 !=99 {
        sum variable_1
        }

Upvotes: 1

Views: 290

Answers (2)

frankundfrei
frankundfrei

Reputation: 325

I think you might want to use an if qualifier, not an if statement. That is append your if statement rather than writing it before your calculation.

sum variable_1 if variable_1 != 99

http://www.stata.com/support/faqs/data-management/multiple-operations/

Upvotes: 1

Metrics
Metrics

Reputation: 15458

sum variable_1 if variable_1 !=99

Upvotes: 1

Related Questions