BookmarkSubscribeRSS Feed
tjones156
Calcite | Level 5

I am trying to figure out how to change character value labels to numeric values. 

For example:

"ABCDEF"=1

"GHIJKL"=2

MNOPQR=3

STUVWX=4

"YZ"=5

 

I know how to do it in the reverse (numeric to character) using proc format. I attempted to use the same method but maybe I am just using the incorrect syntax??? Suggestions please

2 REPLIES 2
ChrisNZ
Tourmaline | Level 20

Like this?

proc format; 
 invalue read     
  "ABCDEF"=1
  "GHIJKL"=2
  'MNOPQR'=3
  'STUVWX'=4
  "YZ"    =5 ;
data T;  
  NUM=input('YZ',read.);
run;

NUM=5

 

andreas_lds
Jade | Level 19

You may want to post code and log so that we can help to improve / fix what you already have.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 990 views
  • 2 likes
  • 3 in conversation