Hi,
I have this model but I want to make a regression model for each specific hour,
proc reg data=dataname(where=(Month in(6,7,8))); model Load=Temperature; label Load="Load (MW)" Temperature="Temperature"; title 'Load vs Temp (Summer)'; run;
How can I include where=(Hour in(1)) or where=(Hour in(22)) etc. I tried
(where=(Month in(6,7,8))(Hour in(1)))
but it didn't work
Also what can I do when I only want a model where Temperature is Between 55 and 65?
if you want two or more conditions in a where clause use AND
(where=(Month in(6,7,8) and Hour in(1)) )
same with temperature
and 55 le temperature le 65
And "Didn't work" is awful vague. Since the syntax you show
(where=(Month in(6,7,8))(Hour in(1)))
would have generated at least one error you should post the code from the LOG including the error message(s). Best is to copy from the log and then paste into a code box to maintain the text formatting of the messages.
If I were looking to get separate models for each hour I would sort my data by the hour variable and use BY Hour; instead of having 12 or 24 separate where clauses.
if you want two or more conditions in a where clause use AND
(where=(Month in(6,7,8) and Hour in(1)) )
same with temperature
and 55 le temperature le 65
And "Didn't work" is awful vague. Since the syntax you show
(where=(Month in(6,7,8))(Hour in(1)))
would have generated at least one error you should post the code from the LOG including the error message(s). Best is to copy from the log and then paste into a code box to maintain the text formatting of the messages.
If I were looking to get separate models for each hour I would sort my data by the hour variable and use BY Hour; instead of having 12 or 24 separate where clauses.
Sorry, one more question:
How can I edit my code to make the x axis go from 60-95 in every plot:
proc sort data=matt (where=(Month in(6,7,8))); by Month Hour; run; proc sgplot data=matt (where=(Month in(6,7,8))); scatter x=Temperature y=Load; by Hour; xaxis label="Temperature (degrees F)"; yaxis label="Load (MW)"; title 'Load vs Temperature'; run;
@matt23 wrote:
Sorry, one more question:
How can I edit my code to make the x axis go from 60-95 in every plot:
proc sort data=matt (where=(Month in(6,7,8))); by Month Hour; run; proc sgplot data=matt (where=(Month in(6,7,8))); scatter x=Temperature y=Load; by Hour; xaxis label="Temperature (degrees F)"; yaxis label="Load (MW)"; title 'Load vs Temperature'; run;
Add a VALUES option to the Xaxis statement. You could either explicitly list the values of interest Values=(60 70 80 95) or use something like values=(60 to 95 by 5) to have a tick mark and value at 60, 65, 70 etc.
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.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.