How do I fit a model that predicts xx from xxx allowing the intercepts to be different for university but forcing the equal slopes using PROC REG? How do I express the three universities to include dummy variables? I need help on how to create the dummy variable manually.
data have;
input university $ xxx xx@@;
datalines;
UGA 2.1 440 UGA 2.2 330 UGA 2.2 460 UGA 2.3 460 UGA 2.4 480
UGA 2.6 510 UGA 3.3 560 UGA 3.4 670 UGA 3.5 630 UGA 3.6 680
UNC 2.4 470 UNC 2.7 650 UNC 2.8 550 UNC 2.9 600 UNC 3.1 660
UNC 3.2 670 UNC 3.4 690 UNC 3.5 690 UNC 3.5 730 UNC 3.5 760
USC 2.2 430 USC 2.3 440 USC 2.4 480 USC 2.5 480 USC 2.9 570
USC 3.0 510 USC 3.2 580 USC 3.5 630 USC 3.6 770 USC 3.9 760
;
proc print;
run;
The syntax is vary much similar to PROC REG. Refer to the PROC GLM Documentation for examples.
Also, the blog post Create dummy variables in SAS may be relevant reading. Here, the two procedures are compared and the code is much simpler with GLM
@JUMMY wrote:
@Reeza, I am only familiar with PROC REG.
You really need to look at PROC GLM in this situation, you do not have to create dummy variables in this case, because PROC GLM creates them for you when you include a variable in the CLASS statement. Anything else in this situation makes your life harder.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.