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

Hello Everyone, I'm trying to execute below code in UNIX (bash):

proc format;

value attr4_fmt
        low - < -90000 = "(< -90000)"
       -90000 - 523999 = "(-90000 - 523999)"
        524000 - high = "(523999 <)";
run;

 

But getting following error:

 

NOTE: PROCEDURE FORMAT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

1531    +        -90000 – 523999 = "(-90000 – 523999)"
                            _
                           22
                           76
ERROR 22-322: Syntax error, expecting one of the following: (, ',', -, <, =.

ERROR 76-322: Syntax error, statement will be ignored.

 

Can someone please help to figure out what I'm missing here ?

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

I'd say, simply overtype this "mock hyphen" with an ordinary hyphen or copy and paste one of the minus signs from your code at this place.

 

Edit: Also, with this character I get the same error message in a Windows SAS session -- not surprisingly, because SAS requires the correct characters, regardless of the operating system.

View solution in original post

13 REPLIES 13
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Works fine on 9.4 windows SAS (note you dont need the < in the first one, it is low to -9000).  Have you tried resetting and running just that code, am thinking maybe something else is causing the problem.:

proc format;
  value attr4_fmt
    low - -90000 = "(< -90000)"
    -90000 - 523999 = "(-90000 - 523999)"
    524000 - high = "(523999 <)";
run;
KP12
Fluorite | Level 6

Yes, that's correct it works completely fine in Windows environment, but in UNIX it doesn't, I believe it's because of misinterpretation of -(negative) sign with -(dash) sign of range by UNIX. I tried running this code after removing negative sign and it worked.

FreelanceReinh
Jade | Level 19

Sounds strange. Can you perhaps save your code (only the PROC FORMAT step) and post it as an attachment (.txt file)?

KP12
Fluorite | Level 6

Attached is the code I'm using in .txt file.

FreelanceReinh
Jade | Level 19

I've just looked at your first attachment with a hex editor: As expected, the "hyphen" in question (between -90000 and 523999) is different from the others: It is '96'x, not '2D'x as it should.

KP12
Fluorite | Level 6
Can you please explain this a bit, I'm very new to UNIX so don't have much idea about it.
FreelanceReinh
Jade | Level 19

I'd say, simply overtype this "mock hyphen" with an ordinary hyphen or copy and paste one of the minus signs from your code at this place.

 

Edit: Also, with this character I get the same error message in a Windows SAS session -- not surprisingly, because SAS requires the correct characters, regardless of the operating system.

KP12
Fluorite | Level 6
Many Thanks 🙂
Astounding
PROC Star

I copied the code as posted, and it ran fine under Unix.  Perhaps there are slight differences between your Windows code and your Unix code?  You could find out by reading your code (line by line, as a long character variable), and printing it out in hex.

KP12
Fluorite | Level 6

I'm using attached code in UNIX, can you please have a look and suggest if I'm missing something ?

FreelanceReinh
Jade | Level 19

Hello @KP12,

 

While your code seems to be okay (and I think you do need the "<" sign), your log excerpt shows different types of "hyphens." Please replace all these by ordinary hyphens and the errors should go away.

KP12
Fluorite | Level 6
Hello @FreelanceReinhard,

Actually I copied the log and pasted here so it looks like different types of hyphens (may be because of font change while pasting), in real all are ordinary hyphens only.
data_null__
Jade | Level 19

It's not the negative 9000 is it the hyphen between the values.  It is hex '96'x not '2D'x like it should be.

 

Capture.PNG

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 13 replies
  • 3619 views
  • 1 like
  • 5 in conversation