Programming the statistical procedures from SAS

slope determination

Reply
Occasional Contributor
Posts: 18

slope determination

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.

Attachment
Esteemed Advisor
Posts: 7,073

Re: slope determination

[ Edited ]

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

 

Occasional Contributor
Posts: 18

Re: slope determination

Hi Art

Thank you for your reply. Is there a way to add the Slope and R2 values in the table?

 

Thank you!

Esteemed Advisor
Posts: 7,073

Re: slope determination

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

Ask a Question
Discussion stats
  • 3 replies
  • 113 views
  • 1 like
  • 2 in conversation