BookmarkSubscribeRSS Feed
JUMMY
Obsidian | Level 7

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;

 

7 REPLIES 7
Reeza
Super User
If you can use PROC GLM, put the University variable in the CLASS statement.
JUMMY
Obsidian | Level 7
@Reeza, I am only familiar with PROC REG.
PeterClemmensen
Tourmaline | Level 20

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

 

Reeza
Super User

@JUMMY wrote:
@Reeza, I am only familiar with PROC REG.

Then you need to create your dummy variables manually. 

JUMMY
Obsidian | Level 7
@can you guide me on how to create them manually?
PaigeMiller
Diamond | Level 26

@JUMMY wrote:
@can you guide me on how to create them manually?

 

A link was already provided (plus advice that you shouldn't bother)

--
Paige Miller
PaigeMiller
Diamond | Level 26

@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.

--
Paige Miller

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 1296 views
  • 0 likes
  • 4 in conversation