BookmarkSubscribeRSS Feed
EMKBB
Calcite | Level 5

Dear All,

How can AbAa, AeAi, AmAp, AfAd, AtAc, . . .   be converted to the code   01, 02, 03, 04, 05, . . .

where the codes 01, 02, . . . are generated by the system? 

I have two columns (variables) of character values as shown above with some of the values repeating,

and I would want to be able to tell which character value was converted to which code. Each variable

holds thousands of values.

Thank you. 

2 REPLIES 2
art297
Opal | Level 21

In order to get the most useful help, you would have to provide more info, specifically regarding how you want to use these codes.

You can always sort the dataset by the field's values and include the nodupkey option to generate a sorted list of the unique values, create the desired number references by creating a field based on the values of _n_ but formatted using the zW. format, and then use proc format with the cntlin option to automatically create the formats or informats that you want.

A nice paper on how to do that can be found at: http://www2.sas.com/proceedings/forum2007/068-2007.pdf

EMKBB
Calcite | Level 5

Dear Art297

Thanks for the lead, I will check the paper up, try it and get back to you.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 2 replies
  • 692 views
  • 0 likes
  • 2 in conversation