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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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