proc format;
value city
0 = “Not Identifiable”
1 = “Big City”
2 = “Small City"
3 = “Metropolitan, Outside City”
4 = “City Status Unknown”
;
run;
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.
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.
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.
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
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.
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.
It helped. The curly quotes were the problems (copied from a pdf text).
Thank you very much. 🙂
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.