DATA Step, Macro, Functions and more

Import text file into SAS

Accepted Solution Solved
Reply
Contributor
Posts: 62
Accepted Solution

Import text file into SAS

Hello,

 

I have a text file like this:

 

ID birth_date sex deathdate

1   21/02/1954 1   

2  02/09/1978   2   03/04/2000

....

 

I use proc import to import text file into sas; however, cause deathdate in first observation is empty, sas assumes that it is character variable. How could I solve it?

 

Thank you


Accepted Solutions
Solution
‎04-11-2017 04:22 AM
Super User
Super User
Posts: 7,392

Re: Import text file into SAS

Look at the log, you will find the datastep import code that proc import created.  Copy this to yur program editor window, and change the informat of the date columns t a date format.  E.g

input birth_date ddmmyy10.

 

View solution in original post


All Replies
Contributor
Posts: 56

Re: Import text file into SAS

After proc import again you can format the deathdate variable in to date format.
Solution
‎04-11-2017 04:22 AM
Super User
Super User
Posts: 7,392

Re: Import text file into SAS

Look at the log, you will find the datastep import code that proc import created.  Copy this to yur program editor window, and change the informat of the date columns t a date format.  E.g

input birth_date ddmmyy10.

 

☑ This topic is SOLVED.

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

Discussion stats
  • 2 replies
  • 111 views
  • 2 likes
  • 3 in conversation