DATA Step, Macro, Functions and more

Need Help Reading Column into Date Format

Accepted Solution Solved
Reply
Contributor
Posts: 20
Accepted Solution

Need Help Reading Column into Date Format

Can someone help me read the DATE variable as a DATE7. format? I failed so I am just reading it as character format. The code is below. I am using SAS University Edition. Thanks.

 

data sasuser.amounts;
   input Name $1-12 EmpID 14-18 Date $20-26 Amt 28-29;
datalines;
ANKERTON, L. 11123 08OCT16 92
ANKERTON, L. 11123 15OCT16 43
DAVIS, R.    22298 04OCT16 16
MASTERS, T.  33351 13OCT16 18
MASTERS, T.  33351         27
THOMAS, A.         21OCT16 15
WOLMER, B.   44483
;

Accepted Solutions
Solution
‎03-22-2018 03:34 PM
Super User
Posts: 6,921

Re: Need Help Reading Column into Date Format

Posted in reply to danielhanbitlee

Assuming that the date always appears in columns 20-26:

 

input .....   @20 date date7.  ...........;

 

You would probably want to add a FORMAT statement to print DATE in the format of your choice when displaying the data.

View solution in original post


All Replies
Solution
‎03-22-2018 03:34 PM
Super User
Posts: 6,921

Re: Need Help Reading Column into Date Format

Posted in reply to danielhanbitlee

Assuming that the date always appears in columns 20-26:

 

input .....   @20 date date7.  ...........;

 

You would probably want to add a FORMAT statement to print DATE in the format of your choice when displaying the data.

Contributor
Posts: 20

Re: Need Help Reading Column into Date Format

Posted in reply to Astounding

Awesome! Thank you!

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 116 views
  • 0 likes
  • 2 in conversation