BookmarkSubscribeRSS Feed
mahen
Fluorite | Level 6

Hi,

if i have a variable A as

       A

20-Aug-1989

87

12-Feb-2018

 

etc.,

how can i get the year 87 to 1987.

 

Please help

3 REPLIES 3
Amir
PROC Star

Hi,

 

If A is a SAS variable, then what type is it and what format does it have, if any?

 

 

Regards,

Amir.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Post test data in the form of a datastep!!

Now we have to go through the stages of asking you questions about what your data looks like.

Is it a date?

Is it character?

Is 87 really 1987?  What if you have 18, is that 1918 or 2018?

 

If its text which I suspect, then:

a=ifc(lengthn(a)=2,cats("19",a),a);

But I would go back to the source and get them to fix it to be safe.

mahen
Fluorite | Level 6

Okay

Thank you so much:)

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 3 replies
  • 630 views
  • 1 like
  • 3 in conversation