Yes! As for my comment, don't be scarred. That is what makes SAS such a useful language. There are always new features, procs and functions being added, which is what makes it the powerful tool that it has been all these years.
Thanks everyone for all your help! I really appreciate it.
How do I mark this as answered? Or do you guys do that?
Whether the format is character or numeric is based on the source data, not the output value. If the incoming source data is character, than the format name should begin with a $. If the incoming source data is numeric, then the format name should not begin with a $, but the values to the left of the = should be actual numbers. What you have listed in your original post is a mix of these two, so you can see why people are confused.
Also, creating a format with PROC Format, does not actually associate the format with any given variable. It merely creates a template that can be used later. So when you say that you "created the numeric value of Race" using a previous PROC Format, that's not actually accurate.
So, if the original input data is numeric then you might use this format:
proc format;
value Race
1= 'White'
other ='Other';
However, if the original input data is character then you might use this format:
proc format;
value $Race
Caucasian = 'White'
other = 'Other';
Also, be aware that character formats are case sensitive...
Sorry, I was trying to save time. I am aware that it is just a template to activate later. and it is not other='other' it really is .='other'. The source data is numeric. The original formating
1 = 'Causian' etc kept it numeric
Let's ignore the 'not entered' for now. I think that is supposed to be other. I will have to double check later. My problem now is now to convert a numeric 'Caucasian' to 'White'.
On the other hand ...
If RACE is really numeric, you need to know what values it actually takes on. Certainly a numeric variable can't take on values like "Caucasian". Code the actual values (not the formatted translations) in the VALUE statement:
value Race
1 = 'White'
2, 3, other='Other';
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.