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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—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
  • 1 reply
  • 903 views
  • 0 likes
  • 2 in conversation