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'
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.