BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
art297
Opal | Level 21

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.

SASFNG
Calcite | Level 5

Thanks everyone for all your help! I really appreciate it. Smiley Happy

SASFNG
Calcite | Level 5

How do I mark this as answered? Or do you guys do that?

TashaChapman
Fluorite | Level 6

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...

SASFNG
Calcite | Level 5

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'.

Astounding
PROC Star

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';


sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

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.

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
  • 20 replies
  • 2120 views
  • 4 likes
  • 6 in conversation