Help using Base SAS procedures

Limit Decimal place in Proc Corr output table

Reply
New Contributor
Posts: 4

Limit Decimal place in Proc Corr output table

Hi,

I computed spearman correlation and output in the table by using following procedure.

Proc Corr Spearman data=mydata outp=corrtable;

var v1-v5;

run;

I want to limit the decimal place (two or three digits after the decimal) in  correlation matrix in output table "corrtable" . Could you sugget me the way to accomplish it.

Thanks,

Shyam

Super User
Posts: 11,343

Re: Limit Decimal place in Proc Corr output table

I wouldn't actually change the value. Use an appropriate format when displaying the values such as:

proc print data=corrtable;

     var v1-v5;

     format v1-v5 f5.3;

run;

to show 3 decimals.

You can make this a default for the output set using Proc datasets to change the default format to the one you want.

New Contributor
Posts: 4

Re: Limit Decimal place in Proc Corr output table

Thanks Ballardw, However, I would like to change the decimal place in a output table when it output from Proc Corr procedure.


Trusted Advisor
Posts: 1,228

Re: Limit Decimal place in Proc Corr output table

You can do it using data step

data corrtable;

  set corrtable(where=(_type_='CORR'));

  format _numeric_ 4.3;

run;

Ask a Question
Discussion stats
  • 3 replies
  • 1450 views
  • 0 likes
  • 3 in conversation