Date input in SAS

Asked

Viewed 1,232 times

2

Please try to enter dates in various ways by input from SAS Enterprise Guide version 7.1, but anyway the result always comes out in numerical form, follow an example of the code:

data work.family;
infile datalines;
input relation $ first_name $ birthdate: mmddyy10.;
cards;
son Frank 01/31/89
daughter June 12-25-87
brother Samuel 01/17/51
run;

In the variable bithdate the inclusion or removal of the two points, or the change in format size always result in the date in numerical form and not date:

relation   first_name birthdate
son        Frank      10623
daughter   June       10220
brother    Samuel     -3271

1 answer

1


I don’t know if this is exactly your question, but just inform FORMAT.

Example:

data work.family;  
infile datalines;  
input relation $ first_name $ birthdate: mmddyy10.;  
format birthdate DDMMYY8.;  
cards;  
son Frank 01/31/89  
daughter June 12-25-87  
brother Samuel 01/17/51  
run;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.