It would be a lot quicker to test for yourself. You won't be able to create the SAS format in the first place if you don't put a dollar sign in the name:
28 proc format;
29 value sexfmt
30 'F'='Female'
ERROR: The quoted string 'F' is not acceptable to a numeric format or informat.
31 'M'='Male'
32 ;
NOTE: The previous statement has been deleted.
33 run;
Yes, it would be quicker just to test it but I won't have access to SAS until tomorrow.
I know when assigning the format-name in the VALUE statement, you need $ for the format-name for character values. My question was, is the $ needed when you reference that format-name.
In your example, when I reference sexfmt in a format statement: format sex $sexfmt.;
I wanted to know in that format statement, if the $ is optional or required.
Thanks again for helping me with all of my questions!
This is the error you get if you drop the dollar sign from the format:
35 proc print data=sashelp.class;
36 format sex sexfmt.;
ERROR: You are trying to use the numeric format SEXFMT with the character variable Sex in data set SASHELP.CLASS.
37 run;
The 2025 SAS Hackathon Kicks Off on June 11!
Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.