Hello
What is wrong with the code below.
I am using proc format with negative values
29 low< -4000='Lower than -4K'
_
22
200
ERROR 22-322: Syntax error, expecting one of the following: (, ',', -, =.
ERROR 200-322: The symbol is not recognized and will be ignored.
proc format;
value ffmt
low< -4000='Lower than -4K'
-4000-< -3000='[-4,-3)'
-3000-< -2000='[-3,-2)'
-2000-< -1000='[-2,-1)'
-1000-<- 0='[-1,0)'
0-< 1000='[0,1)'
1000-< 2000='[1,2)'
2000-< 3000='[2,3)'
3000-< 4000='[3,4)'
4000- high ='[4+'
;
run;
This
low < -4000='Lower than -4K'
should be
low -< -4000='Lower than -4K'
A range needs the hyphen.
Do the following:
proc format;
value ffmt
low -< -4000 = 'Lower than -4K'
-4000 -< -3000 = '[-4,-3)'
-3000 -< -2000 = '[-3,-2)'
-2000 -< -1000 = '[-2,-1)'
-1000 -< 0 = '[-1,0)'
0 -< 1000 = '[0,1)'
1000 -< 2000 = '[1,2)'
2000 -< 3000 = '[2,3)'
3000 -< 4000 = '[3,4)'
4000 - high = '[4+'
;
run;
Note that I added some visual formatting to make the code more readable.
Okay,
I see that the error was
low < -4000
and the correct is
low-< -4000
What is the logic here?
proc format;
value ffmt
low-< -4000='Lower than -4K'
-4000-< -3000='[-4,-3)'
-3000-< -2000='[-3,-2)'
-2000-< -1000='[-2,-1)'
-1000-<- 0='[-1,0)'
0-< 1000='[0,1)'
1000-< 2000='[1,2)'
2000-< 3000='[2,3)'
3000-< 4000='[3,4)'
4000- high ='[4+'
;
run;
This
low < -4000='Lower than -4K'
should be
low -< -4000='Lower than -4K'
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.