BookmarkSubscribeRSS Feed
DanielePugno
Calcite | Level 5

Hi everyone,

 

I'm new to SAS studio and I was trying to use the "proc HPNEURAL" and after I specified all the parameters and the instructions, and ran the code, this message "ERROR: Interval variables must be numeric (F7)." was displayed in the LOG.

Someone can help me to understand what's the meaning of that and how to fix it?

 

If you need other information I'd glad to give it to you.

 

Thank you for your consideration

8 REPLIES 8
PaigeMiller
Diamond | Level 26

You are trying to use a character variable where a numeric variable is required. You can't do that. Perhaps you need to change F7 to numeric first; or perhaps you simply don't want to change F7 to numeric, in which case you can't use it as an interval variable, but it could be used as a categorical variable. You have look at the values of F7 and decide how to move forward.

--
Paige Miller
DanielePugno
Calcite | Level 5

alfanum_variable.png

 First of all, thank you for your help!
I saw in the import output that F7 column is taken as alfanum, but in excel (input file) the cells type is "number" and the content is only the value 0 or 1.
How can I change the type of f7,F8 and ecc from Alfanum in Num?

Thank you for your consideration!

Tom
Super User Tom
Super User

"IMPORT"?

What is the source of the SAS dataset?  Did you use PROC IMPORT to read from a TEXT file, such as a CSV file?  If so then replace the PROC IMPORT step with your own data step where you will have control over how the variables are defined.

 

If you used PROC IMPORT to read from an actual EXCEL worksheet it would only have made F7 as character if the column was completely empty or there was at least one cell that had a character string instead of a number.

PaigeMiller
Diamond | Level 26

Excel is always irrelevant. You need to check the SAS data set and not the Excel file, because SAS Studio works on SAS data sets, not Excel files.

 

I believe you might want to write simple code to do this and then work with the new variable F7A.

 

data new;
    set old;
    f7a = input(f7,1.);
run;

 

However ... this really isn't what HPNeural is expecting either. This is NOT an interval variable. 0/1 binary variables are not interval variables. Changing it to numeric doesn't make it an interval variable. You most likely want this as a nominal variable, in which case you can leave it as alphanumeric (I think).

--
Paige Miller
DanielePugno
Calcite | Level 5

Thank you very much.
How can I make F7,F8, ecc... a nominal variable instead of an interval variable?

PaigeMiller
Diamond | Level 26

According to the HPNeural documentation, you create the proper INPUT statement(s) for Interval variables, and more INPUT statement(s) for the Nominal variables.

--
Paige Miller
ballardw
Super User

@DanielePugno wrote:

alfanum_variable.png

 First of all, thank you for your help!
I saw in the import output that F7 column is taken as alfanum, but in excel (input file) the cells type is "number" and the content is only the value 0 or 1.
How can I change the type of f7,F8 and ecc from Alfanum in Num?

Thank you for your consideration!


Proc import by default only examines a very few rows of data. If a "column" is blank for the first few rows then that is a typical cause of a $1. informat. So I might look back to your Excel file and see about how many blanks exist in the source.

Note: this is just one frequent problem related to Import, which is a guessing procedure, and spreadsheet files.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 8 replies
  • 367 views
  • 1 like
  • 5 in conversation