BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
dkcundiffMD
Quartz | Level 8

Coding with SAS Studio 9.4, I got the following error message:

 

BMI17fNS1=
743 pmeat17KCAj
744 +rmeat17KCAj
745 +fish17KCAj
746 +milk17KCAj
747 +poultry16KCAj
748 +eggs16KCAj
749 ;
750
751 BMI17fNS2=
752 fruits17KCAj
753 +vegetables17KCAj
754 +nutsseeds17KCAj
755 +potatoes16KCAj
756 +wgrains17KCAj
757 +legumes17KCAj
758 +rice16KCAj
759 +swtpot16KCAj;
760
761 BMI17fNS3=BMI17fNS1/BMI17fNS2;
762
763 BMI17fNS4=
764 (BMI17fNS3*3.04491
765 -PAMETs17m*0.00039009) /1.25398;
766
767 BMI17fNS5=BMI17fNS4 +22.20829‬;
___
22
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, -, /, <, <=, <>, =, >, ><, >=, AND, EQ, GE, GT, IN,
LE, LT, MAX, MIN, NE, NG, NL, NOTIN, OR, ^=, |, ||, ~=.
 
768 *
ERROR: The name ‬ is not a valid SAS name.
ERROR: The name ‬ is not a valid SAS name.
 
I first tried to add the 22.20829 in the BMI17fNS4 expression and got the same syntax error. Other times the same simple addition of a constant does not throw an error message. 
 
What is my problem? 
Thanks. 
David K. Cundiff
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@dkcundiffMD wrote:

The ";" at the end of the equation was the spot with the

___
22

However, when I did some further unrelated work on the code and when back, it worked. That has occasionally happened before. I'm still puzzled why. 

Thanks. 


You should always paste Log or Code entries into a code box opened with either the forum's {I} or "running man" icon. The main message windows reformat text and have been known to introduce HTML, or interpret certain characters as HTML for display, characters (seemingly at random) so what you paste may not actually be what the code actually was.

 

Since your posting shows what appears to be Call execute generated code your source code may have an invisible character that only sometimes gets inserted depending on your code or the value in your data set contains a character not valid for names. If you are using Call execute it may help to share both the code and some example data. If you use a data set for generating code you really want to validate the values for use in variable or data set names. Luckily SAS supplies functions MVALID (to test if a string is valid for a member {specify catalog, data set, itemstor, access descriptor etc.} name) and NVALID to check the validity of a string as use in a variable name.

View solution in original post

11 REPLIES 11
data_null__
Jade | Level 19

In your log what is being underlined with

 

___
22

 

Proportional font does not work for SASLOG.

 

Show your log using {i} box.

dkcundiffMD
Quartz | Level 8

The ";" at the end of the equation was the spot with the

___
22

However, when I did some further unrelated work on the code and when back, it worked. That has occasionally happened before. I'm still puzzled why. 

Thanks. 

data_null__
Jade | Level 19

Figure out where these  characters are coming from.

 

Capture.PNG

ballardw
Super User

@dkcundiffMD wrote:

The ";" at the end of the equation was the spot with the

___
22

However, when I did some further unrelated work on the code and when back, it worked. That has occasionally happened before. I'm still puzzled why. 

Thanks. 


You should always paste Log or Code entries into a code box opened with either the forum's {I} or "running man" icon. The main message windows reformat text and have been known to introduce HTML, or interpret certain characters as HTML for display, characters (seemingly at random) so what you paste may not actually be what the code actually was.

 

Since your posting shows what appears to be Call execute generated code your source code may have an invisible character that only sometimes gets inserted depending on your code or the value in your data set contains a character not valid for names. If you are using Call execute it may help to share both the code and some example data. If you use a data set for generating code you really want to validate the values for use in variable or data set names. Luckily SAS supplies functions MVALID (to test if a string is valid for a member {specify catalog, data set, itemstor, access descriptor etc.} name) and NVALID to check the validity of a string as use in a variable name.

dkcundiffMD
Quartz | Level 8

So I just put  {I} in front of anything I'm coding? Or wait till is get a bogus syntax error and then redo with  {I}?

Thanks. 

David K. Cundiff

Tom
Super User Tom
Super User

CLICK on the Insert Code icon or the Insert SAS code icon on the editor menu and a window will pop-up where you can paste the lines of text you copied from your SAS log or program editor.

image.png

dkcundiffMD
Quartz | Level 8
 639        
 640        BMI17f6s=
 641        +pmeat17KCs *0.0257616*0.59026594*100
 642        +rmeat17KCs *0.28559643606‬*0.59026594*100
                                      ___
                                      22
 ERROR: The name ‬ is not a valid SAS name.
 ERROR: The name ‬ is not a valid SAS name.
 ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, -, /, <, <=, <>, =, >, ><, >=, AND, EQ, GE, GT, LE, 
               LT, MAX, MIN, NE, NG, NL, OR, ^=, |, ||, ~=.  
 
 643        +fish17KCs *0.001355444*0.59026594*100
 644        +milk17KCs *0.152948*0.59026594*100
 645        +poultry16KCs *0.32966*0.59026594*100
 646        +eggs16KCs *0.076896*0.59026594*100
 647        
 648        - fruits17KCs *0.022533*0.59026594*100
 649        -vegetables17KCs *0.0311578*0.59026594*100
 650        -nutsseeds17KCs *0.0029001*0.59026594*100
 651        - wgrains17KCs *0.0032282*0.59026594*100
 652        -legumes17KCs *0.010995*0.59026594*100
 653        -corn16KCs*0.00005218*0.59026594*100
 654        -potatoes16KCs*0.00021426*0.59026594*100
 655        -rice16KCs *0.075717*0.59026594*100
 656        -swtpot16KCs *0.001059*0.59026594*100
 657        
 658        -PAMets17ms*0.21541 *0.59026594*100
 659        ;

It happened again. Is this what you mean? 

Thanks. 

data_null__
Jade | Level 19

There are three characters between 6 and * that are not being displayed.  I think your issue may be related to file encoding but I don't know enough about that to be helpful.  @Tom is someone who I believe will be able to explain the issue.

 

 

Capture.PNG

Tom
Super User Tom
Super User

That code E280AC is pop-directional format.  It does not really have a glyph.

https://en.wikipedia.org/wiki/Bidirectional_text

 

Are you by any chances using languages like Arabic or Hebrew that are written from right to left on the page?

dkcundiffMD
Quartz | Level 8
No. I'm not using Arabic, Hebrew, or other foreign language.
Thanks.
dkcundiffMD
Quartz | Level 8

I removed the non displaying code that you pointed out and it worked!

 

Thank you very much. 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 11 replies
  • 1798 views
  • 1 like
  • 4 in conversation