DATA Step, Macro, Functions and more

proc corr on numeric variables gives me error

Accepted Solution Solved
Reply
Contributor
Posts: 46
Accepted Solution

proc corr on numeric variables gives me error

[ Edited ]

hi everybody.

i am trying to use proc corr to find correlation between my numeric variable ,but gives me error for those variable that had missing values even after i removed missing values .the error is: Variable ...... in list does not match type prescribed for this list.
some of my variables had missing values which were shown by NA that i had to remove all the missing rows from my data set then i used proc corr .i guess the reason that sas gives me error for proc corr is that sas may still read those variables as character variables.is there any way in sas to confirm that my variables are numeric ?

appreciate any help.

 

proc corr data=mydata;
var _all_;
run;


Accepted Solutions
Solution
‎11-15-2017 02:57 PM
Super User
Posts: 22,874

Re: proc corr on numeric variables gives me error

Run a proc contents on the data set. The TYPE must be numeric, no matter what it looks like. If it has NA, it's definitely a character variable. You need to convert it to a numeric variable first and then work with it in PROC CORR.

View solution in original post


All Replies
Solution
‎11-15-2017 02:57 PM
Super User
Posts: 22,874

Re: proc corr on numeric variables gives me error

Run a proc contents on the data set. The TYPE must be numeric, no matter what it looks like. If it has NA, it's definitely a character variable. You need to convert it to a numeric variable first and then work with it in PROC CORR.
Esteemed Advisor
Posts: 5,408

Re: proc corr on numeric variables gives me error

Change your code to

 

proc corr data=mydata;
var _numeric_;
run;

 

You'll see who's missing.

PG
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 187 views
  • 2 likes
  • 3 in conversation