Discussion:
Can I specify 2 decimal digits in proc corr?
(too old to reply)
demin
2009-10-06 13:52:29 UTC
Permalink
Can I specify 2 decimal digits in proc corr? or after output to excel,
I can change easily. Thanks.
Ya Huang
2009-10-06 17:58:50 UTC
Permalink
You can modify UniStat table template:

ods path sasuser.templat(update) sashelp.tmplmst(read);

proc template;
edit base.corr.UniStat;
edit Mean;
format = 8.2;
end;
edit StdDev;
format = 8.2;
end;
edit Min;
format = 8.2;
end;
define Max;
format = 8.2;
end;
end;
run;

proc corr data=sashelp.class;
var weight height;
run;


Simple Statistics

Variable N Mean Std Dev Sum
Minimum Maximum

Weight 19 100.03 22.77 1901
50.50 150.00
Height 19 62.34 5.13 1184
51.30 72.00
Post by demin
Can I specify 2 decimal digits in proc corr? or after output to excel,
I can change easily. Thanks.
demin
2009-10-06 18:09:56 UTC
Permalink
Post by Ya Huang
ods path sasuser.templat(update) sashelp.tmplmst(read);
  proc template;
   edit base.corr.UniStat;
      edit Mean;
         format = 8.2;
      end;
      edit StdDev;
         format = 8.2;
      end;
      edit Min;
         format = 8.2;
      end;
      define Max;
          format = 8.2;
      end;
   end;
run;
proc corr data=sashelp.class;
var weight height;
run;
                                   Simple Statistics
   Variable           N        Mean     Std Dev           Sum
Minimum     Maximum
   Weight            19      100.03       22.77          1901
50.50      150.00
   Height            19       62.34        5.13          1184
51.30       72.00
Post by demin
Can I specify 2 decimal digits in proc corr? or after output to excel,
I can change easily. Thanks.- Hide quoted text -
- Show quoted text -
Hi, thanks for the different methods, I've learned new things from you
too.
Arthur Tabachneck
2009-10-06 17:25:41 UTC
Permalink
Demin,

I'm not aware of a way to change it in the proc itself, but you could always
route the output via ods and reformat the results as desired. E.g.,:

ods listing close;
ODS OUTPUT pearsoncorr=corr;

PROC CORR data=sashelp.class;
var height weight age;
run;

ODS OUTPUT CLOSE;
ods listing;

data corr;
set corr;
format _numeric_ 5.2;
run;

proc print data=corr;
run;

HTH,
Art
--------
Post by demin
Can I specify 2 decimal digits in proc corr? or after output to excel,
I can change easily. Thanks.
Huang, Ya
2009-10-06 22:56:15 UTC
Permalink
Hi Art,

Use ods trace on, we can find the table template used for specific
section
of the output. That's how I get the name of "base.corr.UniStat".
For pvlaue, it seems to trace back to "common.pvalue".

Output Added:
-------------
Name: PearsonCorr
Label: Pearson Correlations
Template: base.corr.StackedMatrix
Path: Corr.PearsonCorr

So I thought this should work:

ods trace on;

ods path sasuser.templat(update) sashelp.tmplmst(read);

proc template;

define column Common.PValue;

notes "Default p-value column";

just = r;

format = date.;

end;

run;

proc corr data=sashelp.class;
var weight age;
run;

But it didn't. I have to play a bit more :-)



-----Original Message-----
From: Arthur Tabachneck [mailto:***@NETSCAPE.NET]
Sent: Tuesday, October 06, 2009 3:12 PM
To: SAS-***@LISTSERV.UGA.EDU; Huang, Ya
Subject: Re: Can I specify 2 decimal digits in proc corr?

Ya,

Thanks! I didn't know that.

And, after reading your post, I discovered that one can type ODST in the
command line and see all of the things that are set in the various
templates.

However, I couldn't find how one could change the format of the
correlations or pvalues in the matrix that is output by proc corr. Do
you (or anyone) know how that might be accomplished?

Art
---------
Post by Ya Huang
ods path sasuser.templat(update) sashelp.tmplmst(read);
proc template;
edit base.corr.UniStat;
edit Mean;
format = 8.2;
end;
edit StdDev;
format = 8.2;
end;
edit Min;
format = 8.2;
end;
define Max;
format = 8.2;
end;
end;
run;
proc corr data=sashelp.class;
var weight height;
run;
Simple Statistics
Variable N Mean Std Dev Sum
Minimum Maximum
Weight 19 100.03 22.77 1901
50.50 150.00
Height 19 62.34 5.13 1184
51.30 72.00
Post by demin
Can I specify 2 decimal digits in proc corr? or after output to excel,
I can change easily. Thanks.
Arthur Tabachneck
2009-10-06 22:12:13 UTC
Permalink
Ya,

Thanks! I didn't know that.

And, after reading your post, I discovered that one can type ODST in the
command line and see all of the things that are set in the various
templates.

However, I couldn't find how one could change the format of the correlations
or pvalues in the matrix that is output by proc corr. Do you (or anyone)
know how that might be accomplished?

Art
---------
Post by Ya Huang
ods path sasuser.templat(update) sashelp.tmplmst(read);
proc template;
edit base.corr.UniStat;
edit Mean;
format = 8.2;
end;
edit StdDev;
format = 8.2;
end;
edit Min;
format = 8.2;
end;
define Max;
format = 8.2;
end;
end;
run;
proc corr data=sashelp.class;
var weight height;
run;
Simple Statistics
Variable N Mean Std Dev Sum
Minimum Maximum
Weight 19 100.03 22.77 1901
50.50 150.00
Height 19 62.34 5.13 1184
51.30 72.00
Post by demin
Can I specify 2 decimal digits in proc corr? or after output to excel,
I can change easily. Thanks.
Andre Wielki
2009-10-07 10:07:49 UTC
Permalink
Art and Ya

the object is different
libname tpl "d:\ods92";
*ods path sasuser.templat(update) sashelp.tmplmst(read);
ods path tpl.templat(update) sashelp.tmplmst(read);
proc
template;
define column
Common.Column.Matrix;
notes "Default matrix contents
column";
dynamic csplit id cmwidth cmxwidth
fuzz;
define header
t;
text
_label_;
split =
csplit;
end;
fuzz =
fuzz;
width_max =
cmxwidth;
width =
cmwidth;
just =
l;
header =
t;
id = id;
format = date9.;
generic;
end;
run;
proc corr data=sashelp.class;
var weight age;
run;
HTH
Andre
Hi Art,
Use ods trace on, we can find the table template used for specific
section
of the output. That's how I get the name of "base.corr.UniStat".
For pvlaue, it seems to trace back to "common.pvalue".
-------------
Name: PearsonCorr
Label: Pearson Correlations
Template: base.corr.StackedMatrix
Path: Corr.PearsonCorr
ods trace on;
ods path sasuser.templat(update) sashelp.tmplmst(read);
proc template;
define column Common.PValue;
notes "Default p-value column";
just = r;
format = date.;
end;
run;
proc corr data=sashelp.class;
var weight age;
run;
But it didn't. I have to play a bit more :-)
-----Original Message-----
Sent: Tuesday, October 06, 2009 3:12 PM
Subject: Re: Can I specify 2 decimal digits in proc corr?
Ya,
Thanks! I didn't know that.
And, after reading your post, I discovered that one can type ODST in the
command line and see all of the things that are set in the various
templates.
However, I couldn't find how one could change the format of the
correlations or pvalues in the matrix that is output by proc corr. Do
you (or anyone) know how that might be accomplished?
Art
---------
Post by Ya Huang
ods path sasuser.templat(update) sashelp.tmplmst(read);
proc template;
edit base.corr.UniStat;
edit Mean;
format = 8.2;
end;
edit StdDev;
format = 8.2;
end;
edit Min;
format = 8.2;
end;
define Max;
format = 8.2;
end;
end;
run;
proc corr data=sashelp.class;
var weight height;
run;
Simple Statistics
Variable N Mean Std Dev Sum
Minimum Maximum
Weight 19 100.03 22.77 1901
50.50 150.00
Height 19 62.34 5.13 1184
51.30 72.00
Post by demin
Can I specify 2 decimal digits in proc corr? or after output to excel,
I can change easily. Thanks.
--
André WIELKI
INED (Institut National d'Etudes Démographiques)
Service Informatique
133 Boulevard Davout 75980 Paris Cedex 20
mél : ***@ined.fr tél : 33 (0) 1 56 06 21 54
Arthur Tabachneck
2009-10-07 12:40:32 UTC
Permalink
Andre,

Exactly what I was looking for. I changed the format to produce the OP's
original desire to have 2 decimal places but, of course, wouldn't have even
considered the possibility were it not for your and Ya's posts.

Where did you find the needed information?

Art

p.s. The final code I used:

libname tpl "c:\";
ods path tpl.templat(update) sashelp.tmplmst(read);
proc template;
edit base.corr.UniStat;
edit Mean;
format = 8.2;
end;
edit StdDev;
format = 8.2;
end;
edit Min;
format = 8.2;
end;
define Max;
format = 8.2;
end;
end;
define column Common.Column.Matrix;
notes "Default matrix contents column";
dynamic csplit id cmwidth cmxwidth fuzz;
define header t;
text _label_;
split = csplit;
end;
fuzz = fuzz;
width_max = cmxwidth;
width = cmwidth;
just = l;
header = t;
id = id;
format = 6.2;
generic;
end;
run;

proc corr data=sashelp.class;
var weight height;
run;
---------
Post by Andre Wielki
Art and Ya
the object is different
libname tpl "d:\ods92";
*ods path sasuser.templat(update) sashelp.tmplmst(read);
ods path tpl.templat(update) sashelp.tmplmst(read);
proc
template;
define column
Common.Column.Matrix;
notes "Default matrix contents
column";
dynamic csplit id cmwidth cmxwidth
fuzz;
define header
t;
text
_label_;
split =
csplit;
end;
fuzz =
fuzz;
width_max =
cmxwidth;
width =
cmwidth;
just =
l;
header =
t;
id = id;
format = date9.;
generic;
end;
run;
proc corr data=sashelp.class;
var weight age;
run;
HTH
Andre
Hi Art,
Use ods trace on, we can find the table template used for specific
section
of the output. That's how I get the name of "base.corr.UniStat".
For pvlaue, it seems to trace back to "common.pvalue".
-------------
Name: PearsonCorr
Label: Pearson Correlations
Template: base.corr.StackedMatrix
Path: Corr.PearsonCorr
ods trace on;
ods path sasuser.templat(update) sashelp.tmplmst(read);
proc template;
define column Common.PValue;
notes "Default p-value column";
just = r;
format = date.;
end;
run;
proc corr data=sashelp.class;
var weight age;
run;
But it didn't. I have to play a bit more :-)
-----Original Message-----
Sent: Tuesday, October 06, 2009 3:12 PM
Subject: Re: Can I specify 2 decimal digits in proc corr?
Ya,
Thanks! I didn't know that.
And, after reading your post, I discovered that one can type ODST in the
command line and see all of the things that are set in the various
templates.
However, I couldn't find how one could change the format of the
correlations or pvalues in the matrix that is output by proc corr. Do
you (or anyone) know how that might be accomplished?
Art
---------
Post by Ya Huang
ods path sasuser.templat(update) sashelp.tmplmst(read);
proc template;
edit base.corr.UniStat;
edit Mean;
format = 8.2;
end;
edit StdDev;
format = 8.2;
end;
edit Min;
format = 8.2;
end;
define Max;
format = 8.2;
end;
end;
run;
proc corr data=sashelp.class;
var weight height;
run;
Simple Statistics
Variable N Mean Std Dev Sum
Minimum Maximum
Weight 19 100.03 22.77 1901
50.50 150.00
Height 19 62.34 5.13 1184
51.30 72.00
Post by demin
Can I specify 2 decimal digits in proc corr? or after output to excel,
I can change easily. Thanks.
--
Andrᅵ WIELKI
INED (Institut National d'Etudes Dᅵmographiques)
Service Informatique
133 Boulevard Davout 75980 Paris Cedex 20
Andre Wielki
2009-10-07 13:22:42 UTC
Permalink
Answer:
some practice of template since 8.2
and logic

as ods trace was giving
Post by Huang, Ya
-------------
Name: VarInformation
Label: Variables Information
Template: base.corr.VarInfo
Path: Corr.VarInformation
-------------
-------------
Name: SimpleStats
Label: Simple Statistics
Template: base.corr.UniStat
Path: Corr.SimpleStats
-------------
-------------
Name: PearsonCorr
Label: Pearson Correlations
Template: base.corr.StackedMatrix
Path: Corr.PearsonCorr
and as the pearson correlation was thr third subpart of the output

i went to the template usind odst command
where i search for something near base.corr.StackedMatrix

so i found
proc
template;
define table
Common.StackedMatrix;
notes "Stacked Matrix template definition.";
.................................;

with no format at all
but with many references to
parent = common.column.matrix;


i open matrix template and read
Post by Huang, Ya
proc
template;
define column
Common.Column.Matrix;
notes "Default matrix contents
column";
dynamic csplit id cmwidth cmxwidth
fuzz;
define header
t;
text
_label_;
split =
csplit;
end;
fuzz =
fuzz;
width_max =
cmxwidth;
width =
cmwidth;
just =
r;
header =
t;
id =
id;
generic;
end;
run;
i try to add format= before the end; and before generic!

now to remain in a situation of exploring and not building a definitive
work contexte=
i add prior
libname tpl "d:\ods92";
*ods path sasuser.templat(update) sashelp.tmplmst(read);
ods path tpl.templat(update) sashelp.tmplmst(read);


this manner of doing IS NOT WORKING for print report and tabulate where
the style is to be included inside the sas code
as there are no template for those procedures
HTH
Andre
Post by Huang, Ya
Andre,
Exactly what I was looking for. I changed the format to produce the OP's
original desire to have 2 decimal places but, of course, wouldn't have even
considered the possibility were it not for your and Ya's posts.
Where did you find the needed information?
Art
libname tpl "c:\";
ods path tpl.templat(update) sashelp.tmplmst(read);
proc template;
edit base.corr.UniStat;
edit Mean;
format = 8.2;
end;
edit StdDev;
format = 8.2;
end;
edit Min;
format = 8.2;
end;
define Max;
format = 8.2;
end;
end;
define column Common.Column.Matrix;
notes "Default matrix contents column";
dynamic csplit id cmwidth cmxwidth fuzz;
define header t;
text _label_;
split = csplit;
end;
fuzz = fuzz;
width_max = cmxwidth;
width = cmwidth;
just = l;
header = t;
id = id;
format = 6.2;
generic;
end;
run;
proc corr data=sashelp.class;
var weight height;
run;
---------
Post by Andre Wielki
Art and Ya
the object is different
libname tpl "d:\ods92";
*ods path sasuser.templat(update) sashelp.tmplmst(read);
ods path tpl.templat(update) sashelp.tmplmst(read);
proc
template;
define column
Common.Column.Matrix;
notes "Default matrix contents
column";
dynamic csplit id cmwidth cmxwidth
fuzz;
define header
t;
text
_label_;
split =
csplit;
end;
fuzz =
fuzz;
width_max =
cmxwidth;
width =
cmwidth;
just =
l;
header =
t;
id = id;
format = date9.;
generic;
end;
run;
proc corr data=sashelp.class;
var weight age;
run;
HTH
Andre
Hi Art,
Use ods trace on, we can find the table template used for specific
section
of the output. That's how I get the name of "base.corr.UniStat".
For pvlaue, it seems to trace back to "common.pvalue".
-------------
Name: PearsonCorr
Label: Pearson Correlations
Template: base.corr.StackedMatrix
Path: Corr.PearsonCorr
ods trace on;
ods path sasuser.templat(update) sashelp.tmplmst(read);
proc template;
define column Common.PValue;
notes "Default p-value column";
just = r;
format = date.;
end;
run;
proc corr data=sashelp.class;
var weight age;
run;
But it didn't. I have to play a bit more :-)
-----Original Message-----
Sent: Tuesday, October 06, 2009 3:12 PM
Subject: Re: Can I specify 2 decimal digits in proc corr?
Ya,
Thanks! I didn't know that.
And, after reading your post, I discovered that one can type ODST in the
command line and see all of the things that are set in the various
templates.
However, I couldn't find how one could change the format of the
correlations or pvalues in the matrix that is output by proc corr. Do
you (or anyone) know how that might be accomplished?
Art
---------
Post by Ya Huang
ods path sasuser.templat(update) sashelp.tmplmst(read);
proc template;
edit base.corr.UniStat;
edit Mean;
format = 8.2;
end;
edit StdDev;
format = 8.2;
end;
edit Min;
format = 8.2;
end;
define Max;
format = 8.2;
end;
end;
run;
proc corr data=sashelp.class;
var weight height;
run;
Simple Statistics
Variable N Mean Std Dev Sum
Minimum Maximum
Weight 19 100.03 22.77 1901
50.50 150.00
Height 19 62.34 5.13 1184
51.30 72.00
Post by demin
Can I specify 2 decimal digits in proc corr? or after output to excel,
I can change easily. Thanks.
--
Andrᅵ WIELKI
INED (Institut National d'Etudes Dᅵmographiques)
Service Informatique
133 Boulevard Davout 75980 Paris Cedex 20
--
André WIELKI
INED (Institut National d'Etudes Démographiques)
Service Informatique
133 Boulevard Davout 75980 Paris Cedex 20
mél : ***@ined.fr tél : 33 (0) 1 56 06 21 54
Ya Huang
2009-10-07 15:14:42 UTC
Permalink
Post by Andre Wielki
some practice of template since 8.2
and logic
as ods trace was giving
Post by Huang, Ya
-------------
Name: VarInformation
Label: Variables Information
Template: base.corr.VarInfo
Path: Corr.VarInformation
-------------
-------------
Name: SimpleStats
Label: Simple Statistics
Template: base.corr.UniStat
Path: Corr.SimpleStats
-------------
-------------
Name: PearsonCorr
Label: Pearson Correlations
Template: base.corr.StackedMatrix
Path: Corr.PearsonCorr
and as the pearson correlation was thr third subpart of the output
i went to the template usind odst command
where i search for something near base.corr.StackedMatrix
so i found
proc
template;
define table
Common.StackedMatrix;
notes "Stacked Matrix template definition.";
.................................;
with no format at all
That's why I did not try to modify this template :-) I traced
the parent template all the way back to common.pvalue, and tried to
change it, but it did not work.

This seems different from the style, where you can change the parent
style and the child one will automatically link to the updated parent.
Post by Andre Wielki
but with many references to
parent = common.column.matrix;
i open matrix template and read
Post by Huang, Ya
proc
template;
define column
Common.Column.Matrix;
notes "Default matrix contents
column";
dynamic csplit id cmwidth cmxwidth
fuzz;
define header
t;
text
_label_;
split =
csplit;
end;
fuzz =
fuzz;
width_max =
cmxwidth;
width =
cmwidth;
just =
r;
header =
t;
id =
id;
generic;
end;
run;
i try to add format= before the end; and before generic!
now to remain in a situation of exploring and not building a definitive
work contexte=
i add prior
libname tpl "d:\ods92";
*ods path sasuser.templat(update) sashelp.tmplmst(read);
ods path tpl.templat(update) sashelp.tmplmst(read);
this manner of doing IS NOT WORKING for print report and tabulate where
the style is to be included inside the sas code
as there are no template for those procedures
HTH
Andre
Post by Huang, Ya
Andre,
Exactly what I was looking for. I changed the format to produce the OP's
original desire to have 2 decimal places but, of course, wouldn't have
even
Post by Andre Wielki
Post by Huang, Ya
considered the possibility were it not for your and Ya's posts.
Where did you find the needed information?
Art
libname tpl "c:\";
ods path tpl.templat(update) sashelp.tmplmst(read);
proc template;
edit base.corr.UniStat;
edit Mean;
format = 8.2;
end;
edit StdDev;
format = 8.2;
end;
edit Min;
format = 8.2;
end;
define Max;
format = 8.2;
end;
end;
define column Common.Column.Matrix;
notes "Default matrix contents column";
dynamic csplit id cmwidth cmxwidth fuzz;
define header t;
text _label_;
split = csplit;
end;
fuzz = fuzz;
width_max = cmxwidth;
width = cmwidth;
just = l;
header = t;
id = id;
format = 6.2;
generic;
end;
run;
proc corr data=sashelp.class;
var weight height;
run;
---------
Post by Andre Wielki
Art and Ya
the object is different
libname tpl "d:\ods92";
*ods path sasuser.templat(update) sashelp.tmplmst(read);
ods path tpl.templat(update) sashelp.tmplmst(read);
proc
template;
define column
Common.Column.Matrix;
notes "Default matrix contents
column";
dynamic csplit id cmwidth cmxwidth
fuzz;
define header
t;
text
_label_;
split =
csplit;
end;
fuzz =
fuzz;
width_max =
cmxwidth;
width =
cmwidth;
just =
l;
header =
t;
id = id;
format = date9.;
generic;
end;
run;
proc corr data=sashelp.class;
var weight age;
run;
HTH
Andre
Hi Art,
Use ods trace on, we can find the table template used for specific
section
of the output. That's how I get the name of "base.corr.UniStat".
For pvlaue, it seems to trace back to "common.pvalue".
-------------
Name: PearsonCorr
Label: Pearson Correlations
Template: base.corr.StackedMatrix
Path: Corr.PearsonCorr
ods trace on;
ods path sasuser.templat(update) sashelp.tmplmst(read);
proc template;
define column Common.PValue;
notes "Default p-value column";
just = r;
format = date.;
end;
run;
proc corr data=sashelp.class;
var weight age;
run;
But it didn't. I have to play a bit more :-)
-----Original Message-----
Sent: Tuesday, October 06, 2009 3:12 PM
Subject: Re: Can I specify 2 decimal digits in proc corr?
Ya,
Thanks! I didn't know that.
And, after reading your post, I discovered that one can type ODST in
the
Post by Andre Wielki
Post by Huang, Ya
Post by Andre Wielki
command line and see all of the things that are set in the various
templates.
However, I couldn't find how one could change the format of the
correlations or pvalues in the matrix that is output by proc corr. Do
you (or anyone) know how that might be accomplished?
Art
---------
Post by Ya Huang
ods path sasuser.templat(update) sashelp.tmplmst(read);
proc template;
edit base.corr.UniStat;
edit Mean;
format = 8.2;
end;
edit StdDev;
format = 8.2;
end;
edit Min;
format = 8.2;
end;
define Max;
format = 8.2;
end;
end;
run;
proc corr data=sashelp.class;
var weight height;
run;
Simple Statistics
Variable N Mean Std Dev Sum
Minimum Maximum
Weight 19 100.03 22.77 1901
50.50 150.00
Height 19 62.34 5.13 1184
51.30 72.00
Post by demin
Can I specify 2 decimal digits in proc corr? or after output to
excel,
Post by Andre Wielki
Post by Huang, Ya
Post by Andre Wielki
Post by Ya Huang
Post by demin
I can change easily. Thanks.
--
Andrᅵ WIELKI
INED (Institut National d'Etudes Dᅵmographiques)
Service Informatique
133 Boulevard Davout 75980 Paris Cedex 20
--
André —IELKI
INED (Institut National d'Etudes Dé­¯graphiques)
Service Informatique
133 Boulevard Davout 75980 Paris Cedex 20
Loading...