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 ?
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.
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;
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.
Sounds strange. Can you perhaps save your code (only the PROC FORMAT step) and post it as an attachment (.txt file)?
Attached is the code I'm using in .txt file.
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.
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.
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.
I'm using attached code in UNIX, can you please have a look and suggest if I'm missing something ?
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.
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.
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!
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.
Ready to level-up your skills? Choose your own adventure.