Hi
I have a dataset in SAS. I want to calculate slope and r2 for the data in the last two columns respectively. can you please help me in writing a procedure.
Thank you in advance.
If you only need to find the linear relationship you can obtain both the R2 and slope using PROC REG (see: https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_reg_sect003... )
e.g.:
proc reg; model sum_CiS = Q; run;
HTH,
Art, CEO, AnalystFinder.com
Hi Art
Thank you for your reply. Is there a way to add the Slope and R2 values in the table?
Thank you!
Not sure what you're asking. Both are included in the output.
If you want them output to files, simply capture the ODS tables that contain them. e.g.:
ods output ParameterEstimates=estimates; ods output FitStatistics=stats; /* ods trace on; */ proc reg data=have;; model sum_CiS = Q; run; /* ods trace off; */
I commented out the ods trace on and off statements as they are only used to find out what ods output tables are available.
Art, CEO, AnalystFinder.com
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.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.