11-11-2016 02:49 PM
I have written this code and it says Syntax Error. I dont find anything wrong. Could someone review and let me know the issue?
'11443'-'11621', '11622'-'11772'= 1
Thanks so much
11-11-2016 02:52 PM - edited 11-11-2016 02:53 PM
The output of a format is a character string. The values "1" and "0" need quotes.
If you want a numeric output, you will need to create an informat instead of a format.
11-11-2016 03:26 PM
Thansk fo rth ereply. Even after I put the quotes I have a syntax error!!
812 proc format;
813 value $surgeries
814 '10021'-'10180', '11000'-'11057'
815 '11100'-'11312', '11313'-'11442'
ERROR 22-322: Syntax error, expecting one of the following: (, ',', =.
ERROR 76-322: Syntax error, statement will be ignored.
816 '11443'-'11621', '11622'-'11772'= "1"
NOTE: The previous statement has been deleted.
NOTE: PROCEDURE FORMAT used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
OS Memory 23284.00k
Timestamp 11/11/2016 02:25:03 PM
Step Count 36 Switch Count 0
NOTE: The SAS System stopped processing this step because of errors.
11-11-2016 03:38 PM
It worked. I was misssing a comma between those format pairs.
Just curious that it worked fine even without putting quotes for The values "1" and "0" . Do i need to know anything regarding this?
11-11-2016 04:14 PM
Just think of it in the right way ... a format is always a set of characters, because it is a way to express the actual value of a variable. If you want a numeric result, use an INVALUE statement instead of a VALUE statement, and you can reate an informat.
Glad you got it to work.