BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
contactnishan
Obsidian | Level 7
proc format;
value city
0 = “Not Identifiable”
1 = “Big City”
2 = “Small City"
3 = “Metropolitan, Outside City”
4 = “City Status Unknown”
;
run;


The comma , in the value 3 “Metropolitan, Outside City” causes the following error.
 
 
Syntax error, expecting one of the following: a quoted string, a numeric constant, a datetime constant,
a missing value, ;, LOW, OTHER.
ERROR 76-322: Syntax error, statement will be ignored.
Can't we put a comma there?
 
one more thing... 
how do we remove a format that we created?
for example I created a format named city. now I want to remove that format. How do I remove this particular format?
 
thank you in advance. 🙂
 
 
1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

I think the curly quotes in the code are the root cause of all the issues.

 

@contactnishan: Replace all curly quotes in your code by straight quotes.

 

You can use PROC CATALOG to delete formats:

proc catalog c=formats;
delete city bigcity / et=format;   /* numeric formats */
delete zbigcity     / et=formatc;  /* character formats */
quit;

 

@PaigeMiller: Congrats on reaching the honorable Diamond rank (even skipping three ranks in between)! Well deserved.

View solution in original post

8 REPLIES 8
PaigeMiller
Diamond | Level 26

Commas do not cause the error you are seeing.

 

Example:

proc format;
    value $myfmt "K"='Other, Misc';
run;

When you get an error in the log, show us the LOG and not the code and error detached from the code. Show us the log for these steps with nothing chopped out, and in the order it appears in the LOG. Copy the relevant portions of the log as text and paste it into the window that appears when you click on the </> icon, this causes the formatting of the log to be preserved. I no longer try to decipher unformatted logs.

--
Paige Miller
contactnishan
Obsidian | Level 7
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 proc format;
74 value bigcity
75 0 = “Not Identifiable”
76 1 = “Not in Metro Area”
77 2 = “Metro Inside City”
78 3 = “Metro Outside City”
79 4 = “Metro, City Status Unknown”
_
22
76
ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant, a datetime constant,
a missing value, ;, LOW, OTHER.
ERROR 76-322: Syntax error, statement will be ignored.
80 ;
NOTE: The previous statement has been deleted.
81 run;

NOTE: PROCEDURE FORMAT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

NOTE: The SAS System stopped processing this step because of errors.
82
83 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
95
PaigeMiller
Diamond | Level 26

Copy the relevant portions of the log as text and paste it into the window that appears when you click on the </> icon, this causes the formatting of the log to be preserved. I no longer try to decipher unformatted logs.

--
Paige Miller
contactnishan
Obsidian | Level 7
 proc format;
 value $zbigcity
0 = “Not Identifiable”
1 = “Not in Metro Area”
2 = “Metro Inside City”
3 = “Metro Outside City”
4 = “Metro, City Status Unknown”
                        _
                        22
                        76
 ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant, a datetime constant, 
               a missing value, ;, LOW, OTHER.  
 ERROR 76-322: Syntax error, statement will be ignored.
 80         ;
 NOTE: The previous statement has been deleted.
 81         run;
 
 NOTE: PROCEDURE FORMAT used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 NOTE: The SAS System stopped processing this step because of errors.
 82         
 83         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 95         
PaigeMiller
Diamond | Level 26

Hi, its hard to identify the actual problem here, as it seems as if somehow the log you are showing has been run through a word processor like Microsoft Word (or even PowerPoint), and so what is shown is not the actual log, but a translated version of it. I can tell because you show the curly quotes. 

 

I would like you to copy the log directly from the SAS window, and then paste it into the </> window here, with no intermediate steps; and then the curly quotes will turn into non-curly quotes, and we will see the log exactly as SAS saw it.

--
Paige Miller
contactnishan
Obsidian | Level 7
Yes, it was copy pasted code from a pdf document. When I write all codes from the scratch, there is no error. So the problem is solved.
Thank you very much.
Is it possible for you to help me with deleting a format that I previously assigned.

FreelanceReinh
Jade | Level 19

I think the curly quotes in the code are the root cause of all the issues.

 

@contactnishan: Replace all curly quotes in your code by straight quotes.

 

You can use PROC CATALOG to delete formats:

proc catalog c=formats;
delete city bigcity / et=format;   /* numeric formats */
delete zbigcity     / et=formatc;  /* character formats */
quit;

 

@PaigeMiller: Congrats on reaching the honorable Diamond rank (even skipping three ranks in between)! Well deserved.

contactnishan
Obsidian | Level 7

It helped. The curly quotes were the problems (copied from a pdf text).

 

Thank you very much. 🙂

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 4940 views
  • 2 likes
  • 3 in conversation