BookmarkSubscribeRSS Feed
JUMMY
Obsidian | Level 7

I have a data of this form:

 

data brand;
	input preference moisturecontent sweetness @@;
	datalines;
	64 4 2 73 4 4 61 4 2 76 4 4 72 6 2 80 6 4 
	71 6 2 83 6 4 83 8 2 89 8 4 86 8 2 93 8 4
	88 10 2 95 10 4 94 10 2 100 10 4
	;
run;
proc print;
run;


proc reg data=brand;
model preference=moisturecontent sweetness;
run;

So I used PROC REG to write out the prediction equation. How to I write a separate prediction equation between brand liking and sweetness when moisture content equals to 4 and when moisture content equals to 10? 

3 REPLIES 3
Reeza
Super User
Your code isn't correct. you can't have 'BY MAKE' since you have no make variable.

It's not quite clear what you question is, can you please clarify in detail?
JUMMY
Obsidian | Level 7

@Reeza, I apologize for the mistake. I have corrected it. PROC REG gives the multiple regression line for the data. But I want to come up with two different equations for preference and sweetness when moisture content equals to 4 and when moisture content equals to 10.

Reeza
Super User

@JUMMY wrote:

@Reeza, I apologize for the mistake. I have corrected it. PROC REG gives the multiple regression line for the data. But I want to come up with two different equations for preference and sweetness when moisture content equals to 4 and when moisture content equals to 10.



Put that variable in the BY statement too. The BY statement can take multiple variables and will do it by nested groups. 

 

By make sweetness;

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
  • 3 replies
  • 591 views
  • 0 likes
  • 2 in conversation