Hello ,
I have written this code and it says Syntax Error. I dont find anything wrong. Could someone review and let me know the issue?
proc format;
value $surg
'10021'-'10180', '11000'-'11057'
'11100'-'11312', '11313'-'11442'
'11443'-'11621', '11622'-'11772'= 1
other=0;
run;
Thanks so much
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.
Hello Astounding,
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'
-
22
76
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"
817 other="0";
NOTE: The previous statement has been deleted.
818 run;
NOTE: PROCEDURE FORMAT used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 89.46k
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.
Hello Astounding,
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?
Thanks
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.
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.