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?
@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.
@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;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.