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

I think substr could be use both numeric and charteric variables.  But I have used 'PUT' to change first.

jdwaterman91
Obsidian | Level 7

The "str" portion of "substr" implies that you are working with a string, or character variables.

Yes you can convert your numeric variable to a character variable by using the Put function or by creating a new character variable equal to your numeric variable, but in the end the substr function is still evaluating a character string.

 

It is probably in your best interest to use one of the alternative methods provided here on the thread however.  

They are a lot simpler.

 

ybz12003
Rhodochrosite | Level 12

Thanks for taking time to explaining to me.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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
  • 17 replies
  • 2168 views
  • 7 likes
  • 5 in conversation