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.);

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
  • 2696 views
  • 3 likes
  • 7 in conversation