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

I made this format. When I apply it to my data, only the first value is being changed (from "01-P" to "P"). What am I missing? 

 

proc format library=caus; 
	value $tmp 
		"01-P" = "P"
		"02-B" = "B"
		"03-E" = "E"
		"04-P" = "P"
		"05-CU" = "CU"
                "07-C" = "C"
		;
run;
1 ACCEPTED SOLUTION

Accepted Solutions
kz_
Quartz | Level 8 kz_
Quartz | Level 8
Nevermind! I refreshed SAS and it works. No idea what was going on, but I also don't know how to delete this post.

View solution in original post

6 REPLIES 6
Reeza
Super User
Show how you tried to use it - did you ensure the new variable has the required length needed?
Reeza
Super User
Also looks like SCAN() may be useful as well since it's just taking the last portion?

new_var = scan(var, 2, "-");
kz_
Quartz | Level 8 kz_
Quartz | Level 8
Thank you. I got it to work by refreshing.
kz_
Quartz | Level 8 kz_
Quartz | Level 8
Nevermind! I refreshed SAS and it works. No idea what was going on, but I also don't know how to delete this post.
SASKiwi
PROC Star

You don't delete posts, you just update them as answered.

Reeza
Super User
Preferably with the answer!

Someone else may have the same issue, whatever it is 🙂

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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