BookmarkSubscribeRSS Feed
jopo12345678
Calcite | Level 5

Hello everyone,

I am facing to this problem.

I have this

Snímka.PNG

and I wanna converted to this format

Snímka.PNG

Has anybody know how to solve this problem?

5 REPLIES 5
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Is record date a numeric date?  If so then just format it:

format recorddate yymmn6.;
jopo12345678
Calcite | Level 5

It works but it doesnt change to numeric format as need it.

 

 

Snímka.PNG

Kurt_Bremser
Super User

@jopo12345678 wrote:

It works but it doesnt change to numeric format as need it.

 

 

Snímka.PNG


The "calendar" icon beside the variable name clearly tells us that this is a numeric variable.

If you want to get the integer number 201401 (which is basically useless for any type of computation), you need to do

recorddate = input(put(recorddate,yymmn6.),6.);
format recorddate 6.;
Astounding
PROC Star

I'm guessing that record date is character, and that snapshot date could be character as well:

 

length snapshot $ 6;

snapshot = scan(RecordDate, 3, '.') || scan(RecordDate, 2, '.');

Tom
Super User Tom
Super User

How are we supposed to tell what values you have or want from photographs of your screen?

 

How is the variable RecordDate defined?  Is it a character? Or a date variable with format like DDMMYYp10. attached to it so that it displays in DMY order with periods between the parts?

 

How do you want the SNAPSHOT variable defined? Do you want a character string? Do you want a date value with a format like YYMMN6. attached to it so it display with four digit year and two digit month and nothing between the parts?  Or perhaps you want to make SNAPSHOT as just a numeric variable and not a date at all, just a number where you have put the month of the year into the ones and tens place and the calendar year into the higher place digits?

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of 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
  • 5 replies
  • 1030 views
  • 1 like
  • 5 in conversation