I would like to perform an ANOVA analysis with a blocking variable.
My dependent variable would be Intensity (interval)
My independent variable is Name (A1 through A16)
And my blocking variable would be mass (interval). In order to use mass as a blocking factor, I would have to transform it into a categorical variable. Basically, I would like to do something similar to an Interactive Grouping (EM) for Mass in Base SAS depending on the values for Name.
I need to know which mass intervals are associated with which names.
Any ideas?
Thanks
You can create the categorical variable as in next demo:
proc format lib=work;
value ctagx
low - -10 = "LT -10"
-10 - 0 = "-10 - 0"
0 - 100 = "0 - 100"
100 - high = " GT 100"
; run;
You can define your own ranges, as much as you need, and the labels (righ side) you prefer.
The LOW - / - HIGH rows are optional.
After creating the format you need create your categories, as in:
data want;
set have;
category = put(num_var , catgx.);
... other code as needed ...
run;
I hope one of the next two fits to what you want:
either - assigning a name to a range:
proc format lib=work;
value ctagx
low - -10 = "A1"
-10 - 0 = "A2"
0 - 100 = "A3"
100 - high = "A4"
; run;
OR - assigning a range to a name you already have:
proc format lib=work;
value ctagx
"A1" = "LT -10"
"A2" = "-10 - 0"
"A3" = "0 - 100"
"A4" = " GT 100"
; run;
in this last case change the code in the data step:
category = put(num_var , $catgx.);
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.