SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
fatemeh
Quartz | Level 8

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;

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
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

2 REPLIES 2
Reeza
Super User
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.
PGStats
Opal | Level 21

Change your code to

 

proc corr data=mydata;
var _numeric_;
run;

 

You'll see who's missing.

PG

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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