Help using Base SAS procedures

Invalid numeric data, '<.0001' , at line....

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 8
Accepted Solution

Invalid numeric data, '<.0001' , at line....

This message occurs when I use an output data set (SpearmanCorr) in proc corr.

I would like to remove these notes;

15354:NOTE: Invalid numeric data, '<.0001' , at line 101090 column 212.

15355:NOTE: Invalid numeric data, '_' , at line 101090 column 11.

My code looks like this;

ods output SpearmanCorr=mycorrpvalue;

proc corr spearman data=mydata ;

var myvariable;

run;

data new;

set mycorrpvalue;

if myvariable='<.0001' then myvariable=0.0001;

if myvariable='_' then myvariable=.;

if 0<myvariable<0.001 then newvar=0.001;

else newvar=.;

run;

This is because the data set mycorrpvalue contains numbers and characters, '<.0001' and '_'.

How can I totally replace these characters with number?

Sincerely,

Nish


Accepted Solutions
Solution
‎08-26-2015 08:47 AM
Super User
Posts: 5,518

Re: Invalid numeric data, '<.0001' , at line....

The data does not actually contain characters.  In ODS output data sets, p-values typically are numeric, but have a format applied.  (Running a PROC CONTENTS on MYCORPVALUE will reveal that.)  You can remove the format with:

data new;

set mycorpvalue;

format myvariable;

run;

Good luck.

View solution in original post


All Replies
Solution
‎08-26-2015 08:47 AM
Super User
Posts: 5,518

Re: Invalid numeric data, '<.0001' , at line....

The data does not actually contain characters.  In ODS output data sets, p-values typically are numeric, but have a format applied.  (Running a PROC CONTENTS on MYCORPVALUE will reveal that.)  You can remove the format with:

data new;

set mycorpvalue;

format myvariable;

run;

Good luck.

Occasional Contributor
Posts: 8

Re: Invalid numeric data, '<.0001' , at line....

Posted in reply to Astounding

It worked!  Thank you very much!

Super User
Posts: 10,046

Re: Invalid numeric data, '<.0001' , at line....

There are must be some missing value or very small value .

Try round() function to reform your data.

Super User
Posts: 7,866

Re: Invalid numeric data, '<.0001' , at line....

Is myvariable actually character or numeric with a special format?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 8

Re: Invalid numeric data, '<.0001' , at line....

Posted in reply to KurtBremser

Yes, the myvariable had a format.

  #Variable     TypeLenFormat

1myvariable  Num   8PVALUE8.4

I could remove it using;

data new;

set mycorpvalue;

format myvariable;

run;

Thank you for your answer!

🔒 This topic is solved and locked.

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

Discussion stats
  • 5 replies
  • 323 views
  • 3 likes
  • 4 in conversation