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

Hello

I want to create proc format with ranges that included negative values

I receive an error 

28 low<(-100000)='Lower than -100K'
_
22
76
ERROR 22-322: Syntax error, expecting one of the following: (, ',', -, =.

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

 

  proc format;
value ffmt    
		low<(-100000)='Lower than -100K'
                (-100000)-<(-50000)='[-100,-50)'
                (-50000)-<(-40000)='[-50,-40)'
                (-40000)-<(-30000)='[-40,-30)'
                (-30000)-<(-20000)='[-30,-20)'
                (-20000)-<(-15000)='[-20,-15)'
                (-15000)-<(-10000)='[-15,-10)'
                (-10000)-<(-5000)='[-10,-5)'
                (-5000)-<(-1000)='[-5,-1)'
                (-1000)-<0='[-1,0)'
                0-<1000='[0,1)'
                1000-<5000='[1,5)'
                5000-<10000='[5,10)'
                10000-<15000='[10,15)'
                15000-<20000='[15,20)'
                20000-<30000='[20,30)'
                30000-<40000='[30,40)'
                40000-<50000='[40,50)'
                50000-<100000='[50,100)'
                100000-high ='[100+'
;
run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
Shmuel
Garnet | Level 18

You don't need the parenthesis. Try:

proc format lib=work;
  value test
     low -  -1000 = "less then -1K"
     -100 - 0 = "Still negative"
     0 - high = 'Positive"
; run;

View solution in original post

2 REPLIES 2
andreas_lds
Jade | Level 19

@Ronein wrote:

Hello

I want to create proc format with ranges that included negative values

I receive an error 

28 low<(-100000)='Lower than -100K'
_
22
76
ERROR 22-322: Syntax error, expecting one of the following: (, ',', -, =.

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


 

Please check the line mentioned in the log ... there is an obvious syntax error. Comparing it to the other range-definitions may help.

Shmuel
Garnet | Level 18

You don't need the parenthesis. Try:

proc format lib=work;
  value test
     low -  -1000 = "less then -1K"
     -100 - 0 = "Still negative"
     0 - high = 'Positive"
; run;
How to Concatenate Values

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1601 views
  • 1 like
  • 3 in conversation