LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (April 2006, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sun, 9 Apr 2006 09:47:07 +0200
Reply-To:     Rune Runnestø <rune@FASTLANE.NO>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Rune Runnestø <rune@FASTLANE.NO>
Subject:      date trouble
Comments: To: sas-l@uga.edu

/* Hi

This is the file 'c:\temp\myfile.txt':

FIRST DATE: 18.05.1981 LAST DATE.: 03.03.1983 FIRST DATE: 19.06.1982 LAST DATE.: 04.04.1984 FIRST DATE: 20.07.1983 LAST DATE.: 05.05.1985 FIRST DATE: 21.08.1984 LAST DATE.: 06.06.1986 FIRST DATE: 22.09.1985 LAST DATE.: 07.07.1987 FIRST DATE: 23.10.1986 LAST DATE.: 08.08.1988

*/

*Reading the date values into the column 'date' in a data set;

data test; attrib date length = 8; infile 'c:\temp\myfile.txt'; input @'FIRST DATE:' date ddmmyy10.; format date ddmmyy10.; run; proc print; run; * got the wrong values: Obs date 1 18/05/2019 2 19/06/2019 3 20/07/2019 4 21/08/2019 5 22/09/2019 6 23/10/2019 ;

*trying with both columns; data test; attrib date1 length = 8 date2 length = 8 ; infile 'c:\temp\myfile.txt'; input @'FIRST DATE:' date1 ddmmyy10. @'LAST DATE.:' date2 ddmmyy10. ; format date1 yymmdd10.; run; proc print;run; *get wrong values for date1, got missing values for date2

Obs date1 date2 1 2019-05-18 . 2 2019-06-19 . 3 2019-07-20 . 4 2019-08-21 . 5 2019-09-22 . 6 2019-10-23 .

;

/* 1) How can I read the date values correct into the data set as numeric values ?

2) How can I convert from character to numeric *after* I have read them into the data set ?

Regards Rune

*/


Back to: Top of message | Previous page | Main SAS-L page