- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi....I am trying to format variables after the correlation matrix is derived so that the output table would have the formatted names. I get an error message. Any suggestions on how to format the variables...thanks
proc corr data=have plots=none spearman vardef=df fisher(alpha=0.05 biasadj=yes rho0=0 type=twosided);
var Q15_1 Q15_2 Q15_3 $QuestionCharB.;
run;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Your VAR statement cannot have formats in it.
I am trying to format variables after the correlation matrix is derived so that the output table would have the formatted names
I don't think this makes sense, as I suppose you could apply formats to the values of the Spearman correlations (or maybe you need to edit the template to do that, I have never tried either), but any format would not apply to the names of the variables.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Spearman Correlation Statistics (Fisher's z Transformation)
Variable With Variable N Sample Correlation Fisher's z Bias Adjustment Correlation Estimate H0:Rho=Rho0
95% Confidence Limits Rho0 p Value
Q15_1 Q15_2 5 0.97468 2.17827 0.12183 0.96781 0.585331 0.997955 0 0.0021
Q15_1 Q15_3 6 0.94118 1.74825 0.09412 0.92942 0.479666 0.992419 0 0.0025
Q15_1 Intake1 6 0.21004 0.21322 0.02100 0.18988 -0.734935 0.867725 0 0.7119
Q15_2 Q15_3 6 0.98518 2.44889 0.09852 0.98199 0.839296 0.998111 0 <.0001
Q15_2 Intake1 6 -0.10050 -0.10084 -0.01005 -0.09055 -0.840355 0.778201 0 0.8613
Q15_3 Intake1 8 0 0 0 0 -0.704673 0.704673 0 1.0000
Hi Reeza…. Each variable represents a question. What I am trying to do is to end up with the table above with the actual question for each variable. I did use the Questions as the variables and ran the proc corr but the variable names were truncated because the length of each question was too long for the variables. So I am wondering if it possible to do the formatting on the outputs table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi Reeza…..No I haven't tried applying variable labels. I think I will have to just edit the table as needed. But thank you for your help...greatly appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@twildone wrote:
Hi....I am trying to format variables after the correlation matrix is derived so that the output table would have the formatted names. I get an error message. Any suggestions on how to format the variables...thanks
proc corr data=have plots=none spearman vardef=df fisher(alpha=0.05 biasadj=yes rho0=0 type=twosided); var Q15_1 Q15_2 Q15_3 $QuestionCharB.; run;
Since the VAR variables in Proc Corr are expected to be numeric then a character variable $QuestionCharB. really doesn't make any sense.
Are you actually attempting to change the values of the variables for the purpose of calculating correlation? You would need to do that in a data step prior to Proc Corr.
It might help to provide some example input data and what you are attempting to get as output from that data.
Provide the data in the form of a data step. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.
Or alternately use one of the SAS supplied data sets in the SASHELP library to demonstrate.