Learning SAS? Welcome to the exclusive online community for all SAS learners.

PROC ANOVA ERROR : invalid characters were present in the data

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 19
Accepted Solution

PROC ANOVA ERROR : invalid characters were present in the data

Hi,

I 'm trying to do a one way variance analysis in Sas University Edition using the PROC ANOVA and i can't stop getting this error

ERROR: Invalid characters were present in the data.

There is my code : 

data Clover;
      input Strain $ Nitrogen @@;
      datalines;
   3DOK1  19.4 3DOK1  32.6 3DOK1  27.0 3DOK1  32.1 3DOK1  33.0
   3DOK5  17.7 3DOK5  24.8 3DOK5  27.9 3DOK5  25.2 3DOK5  24.3
   3DOK4  17.0 3DOK4  19.4 3DOK4   9.1 3DOK4  11.9 3DOK4  15.8
   3DOK7  20.7 3DOK7  21.0 3DOK7  20.5 3DOK7  18.8 3DOK7  18.6
   3DOK13 14.3 3DOK13 14.4 3DOK13 11.8 3DOK13 11.6 3DOK13 14.2
   COMPOS 17.3 COMPOS 19.4 COMPOS 19.1 COMPOS 16.9 COMPOS 20.8
   ; 
   run ; 
   proc anova data = Clover;
      class strain;
      model Nitrogen = Strain;
   run;

Can anyone help me please ?

Thank you

Raihana


Accepted Solutions
Solution
‎06-16-2017 09:02 AM
Super User
Posts: 19,770

Re: PROC ANOVA ERROR : invalid characters were present in the data

I ran this in SAS UE at home and it ran fine. 

I do suspect that it's a language issue. Perhaps @RandyMullis can comment or get this tested.

View solution in original post


All Replies
Super User
Posts: 19,770

Re: PROC ANOVA ERROR : invalid characters were present in the data

Code ran fine for me, with no errors.

 

Restart your sas session, paste your code into a text editor and then paste back into SAS to remove any weird characters and re-run.

Super User
Posts: 19,770

Re: PROC ANOVA ERROR : invalid characters were present in the data

PROC ANOVA does require a QUIT instead of a RUN as well.

 

data Clover;
      input Strain $ Nitrogen @@;
      datalines;
   3DOK1  19.4 3DOK1  32.6 3DOK1  27.0 3DOK1  32.1 3DOK1  33.0
   3DOK5  17.7 3DOK5  24.8 3DOK5  27.9 3DOK5  25.2 3DOK5  24.3
   3DOK4  17.0 3DOK4  19.4 3DOK4   9.1 3DOK4  11.9 3DOK4  15.8
   3DOK7  20.7 3DOK7  21.0 3DOK7  20.5 3DOK7  18.8 3DOK7  18.6
   3DOK13 14.3 3DOK13 14.4 3DOK13 11.8 3DOK13 11.6 3DOK13 14.2
   COMPOS 17.3 COMPOS 19.4 COMPOS 19.1 COMPOS 16.9 COMPOS 20.8
   ; 
   run ; 

     proc anova data = Clover;
      class strain;
      model Nitrogen = Strain;
   run;quit;

 

Occasional Contributor
Posts: 19

Re: PROC ANOVA ERROR : invalid characters were present in the data

Still getting the error :/

Are you sure  you 're use a SAS university Edition ?

Super User
Posts: 19,770

Re: PROC ANOVA ERROR : invalid characters were present in the data

No, I'm not using SAS University Ediiton, but nothing in your code is specific to SAS UE. 

 

Post your full log. 

 

I suspect your data isn't being read in correctly for some reason, most likely an issue with the browser adding 'gremlins' invisible characters of some sort. Did you paste it into the text editor like I suggested? If so, check the text for invisible characters and see what shows up.

Occasional Contributor
Posts: 19

Re: PROC ANOVA ERROR : invalid characters were present in the data

Here it is

1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 61         
 62         data Clover;
 63               input Strain $ Nitrogen @@;
 64               datalines;
 
 NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
 NOTE: The data set WORK.CLOVER has 30 observations and 2 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 71            ;
 
 72            run ;
 73         
 74              proc anova data = Clover;
 75               class strain;
 76               model Nitrogen = Strain;
 77            run;
 
 ERROR: Invalid characters were present in the data.
 ERROR: Une erreur s'est produite lors du traitement des données texte.
 ERROR: Invalid characters were present in the data.
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE ANOVA used (Total process time):
       real time           0.07 seconds
       cpu time            0.08 seconds
       
 77       !        quit;
 78         
 79         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 92         
Super User
Posts: 19,770

Re: PROC ANOVA ERROR : invalid characters were present in the data

Can you post a proc print of the clover file?

 

proc print data=clover;

run;

 

I suspect the issue is you're running it in a different language (french) and you were correct - it's related specifically to SAS UE Smiley Happy

I'm not sure how to fix the issue. Perhaps move the data to a text file and import it?

Occasional Contributor
Posts: 19

Re: PROC ANOVA ERROR : invalid characters were present in the data

I 'll try it

Thank's anyway Smiley Happy

Solution
‎06-16-2017 09:02 AM
Super User
Posts: 19,770

Re: PROC ANOVA ERROR : invalid characters were present in the data

I ran this in SAS UE at home and it ran fine. 

I do suspect that it's a language issue. Perhaps @RandyMullis can comment or get this tested.

Occasional Contributor
Posts: 19

Re: PROC ANOVA ERROR : invalid characters were present in the data

##- But if the problem is related to the language, how do the other
procedures work without any data error ? . -##
Super User
Posts: 11,343

Re: PROC ANOVA ERROR : invalid characters were present in the data

It could well depend on which other procedures. For instance Proc Print generally ignores the content of a character variable as it only displays the value and lets the font/NLS/output system deal with it. Proc Anova would need to decompose the values to identify each unique value.

 

Note that data that is copy and pasted from websites and such sometimes acquire non-visible issues or sometimes hide double-byte characters.

I have had multiple instanced of copying datastep code from this forum that generate similar errors to the one you see or get eroneous results. I have enough experiece with diagnostics from datasteps to sometimes identify the exact location causing the problem in datalines for example. I found that in some cases I could "delete" a character in the editor which did not remove the visible data but did remove something that allowed the code to run correctly.

Occasional Contributor
Posts: 19

Re: PROC ANOVA ERROR : invalid characters were present in the data

##- Hello !
You were right, it was a language issue, i changed it to english and now my
code run without any errors. However, i still don't get how can the
software language affect the code :/
Anyway thank you so much for your help Smiley Happy -##
Super User
Posts: 19,770

Re: PROC ANOVA ERROR : invalid characters were present in the data

I think it has to do with the character sets available and/or the encoding setting. 

Not sure if it's the browser that's introducing the issue or an issue with SAS UE. 

Glad that changing it to English worked.  

 

 

 

Occasional Learner
Posts: 1

Re: PROC ANOVA ERROR : invalid characters were present in the data

Hello,

I think I have the same problem with my SAS UE. How can I change it to English ?

Thanks

Occasional Contributor
Posts: 19

Re: PROC ANOVA ERROR : invalid characters were present in the data

Posted in reply to lmchevalier
##- Hi,
You need to change the language set up of your browser to english and it
will work Smiley Happy -##
☑ This topic is solved.

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

Discussion stats
  • 14 replies
  • 606 views
  • 1 like
  • 4 in conversation