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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 1156 views
  • 2 likes
  • 3 in conversation