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

HI ,

i have string reg_date in char format, but when i import to SAS i want it to be date one.

reg_date
112114
022317
071615

 

when i try to do using input its not working.

 

data sas_agent_policy_comp ;
set sas_agent_policy_comp;

reg_date1=input(regdate,mmddyy10.);

pcyear=year(reg_date);

run;

 

i want the informat this variable to be date9. and format should be mmddyy10.

 

can you pleaase how can i read that variable as informat date9. into sas.

 

thanks,

goutham

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

And what does that number actually mean: 112114?  Is it 21Nov14?  14Nov1921?  

This:

reg_date1=input(regdate,mmddyy10.);

 

Will clearly not work as the length of 112114 is not 10, mmddyy10 is expecting 10 characters, e.g. 11-12-2014.

Perhaps mmddyy6. or the mdy() function.

 

View solution in original post

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26

And what does that number actually mean: 112114?  Is it 21Nov14?  14Nov1921?  

This:

reg_date1=input(regdate,mmddyy10.);

 

Will clearly not work as the length of 112114 is not 10, mmddyy10 is expecting 10 characters, e.g. 11-12-2014.

Perhaps mmddyy6. or the mdy() function.

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 1 reply
  • 625 views
  • 0 likes
  • 2 in conversation