## Questions on basic SAS coding for dealing with an ordinal variable

Occasional Contributor
Posts: 16

# Questions on basic SAS coding for dealing with an ordinal variable

Okay, we have several factors such as SEX, INCOME, SMOKING, and EDUCATION, and let's say that I am trying to evaluate the bivariate assocation between WEIGHT AS AN *ORDINAL* VARIABLE and mortality. I am supposed to use if/then/else statement and make categories for WEIGHT, but I am supposed to treat it as an ordinal variable, instead of treating as a continuous variable. What does it mean by treating my WEIGHT variable as an ordinal variable and recode it with if/then/else statement?

I understand what continuous (Tenperature, time of day, zero doesn't mean the missing value, weight, height and age)  and ordinal (i.e. grades, levels of agreement (disagree/strongly disagree. etc *interval* not the same)  variables mean. I know how to categorize with IF/THEN/ELSE statement.

Now, How do I order SAS to treat the WEIGHT variable as an ordinal variable?

Super Contributor
Posts: 644

## Re: Questions on basic SAS coding for dealing with an ordinal variable

Treating weight as an ordinal varaible would mean assigning ordered categories of weight that are not (necessarily) linear functions of weight.

My suggestion would be to use Proc Rank to split the population into deciles and assign each one a category number.  Other strategies might give somewhat different results.  I doubt there is one "right " way to do this.

Richard

PROC Star
Posts: 8,167

## Re: Questions on basic SAS coding for dealing with an ordinal variable

Bythe,

I'm not a statistician, but I may be able to answer your question anyhow, kindof, sortof.

You mentioned levels of agreement as a comparison and that happens to be an interesting one to compare with.

Many researchers would consider a likert-type scale as being one level above ordinal, namely one with equal appearing intervals and use that logic to allow them to use parametric statistics in analyses where that variable is used as either a dependent measure or a measure in some type of modelling.

You don't (I don't think) have to tell SAS any variable's level of measurement, but you (or more specifically, the analysts) are responsible for insuring that the collection of measures included meet the assumptions of the particular test being used to conduct the analysis.

.

Occasional Contributor
Posts: 16

## Re: Questions on basic SAS coding for dealing with an ordinal variable

Another puzzling thing is that the dataset does not have a WEIGHT column, and I am supposed to treat it like an ordinal variable. How do I make SAS to read the variable if the dataset does not have the weight column?

PROC Star
Posts: 8,167

## Re: Questions on basic SAS coding for dealing with an ordinal variable

You will have to ask where you are supposed to obtain subjects' weights.  I'd presume they are in another dataset that will have to be merged with the dataset that you currently have.

SAS Super FREQ
Posts: 4,245