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

@Kurt_Bremser  thank you for mapping this.

Thought i posted the ? in wrong group...infact i am working on DI thought of posting in right platform.

Tom
Super User Tom
Super User

@vnreddy wrote:

Hi @Kurt_Bremser 

 

Variable is in Numeric format.

No format is attached to it, i want the output column as well to be in Numeric format.


In SAS a format is instructions for how to display the values.  You are using the word FORMAT when you mean TYPE.  SAS has two types of variables, fixed length strings and floating point numbers.

 

You want to convert a number to another number. You want to treat the original numbers as if they are in the form YY,YYM,MDD (so the tens and ones place are the day of the month) and treat the target numbers as if they are in the form DD,MMY,YYY (so the tens are ones place are the year within the century).

 

So use PUT + Z8. format to convert the original number to text. Then use INPUT() + YYMMDD. informat to convert that text into a date number.  Then you can use PUT() + DDMMYYN format to convert that date into a string in the right style. Now you can use an INPUT() function with the normal numeric informat to convert that string into a number.

want = input(put(input(put(have,z8.),yymmdd8.),ddmmyyn8.),8.);

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 17 replies
  • 4855 views
  • 3 likes
  • 7 in conversation