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 (January 2000, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 3 Jan 2000 18:47:27 +0000
Reply-To:   Peter Crawford <Peter@CRAWFORDSOFTWARE.DEMON.CO.UK>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Peter Crawford <Peter@CRAWFORDSOFTWARE.DEMON.CO.UK>
Subject:   Re: Strange date problem
In-Reply-To:   <20000103165052.2666.qmail@hotmail.com>

James Yang has a problem with reading some data

I think it needs very few changes (as below) to make the input statement reproduce the input file.... but (see later)

James Yang <jamesy99@HOTMAIL.COM> writes >When I read in raw data, I faced following strange problem. Please kindly >provide your valuable advice. Thanks!!!!! > >FILE1 is the external file which I want to read in, the data look like this: > >S001, 02-AUG-91, 02-AUG-91, SUM1, A >S002, 11-AUG-90, 11-AUG-90, SUM1, B > >I wrote following program to read in this data; > >Data test; > infile file1 dsd; > input Studid & enrdate date9. enrdate1 date9. sem $ grade $;

Change that input statement to this input Studid $ enrdate & date9. enrdate1 & date9. sem $ grade $;

It worked for me on win95 v6.12 ts045 But .... see below

> format enrdate enrdate1 date9.; >run; > >Follwoing is the strange output; > >STUDID ENRDATE ENRDATE1 SEM GRADE >S001 02AUG1991 02AUG1909 1 SUM1 >S002 11AUG1990 11AUG1909 0 SUM1 > >The first one ENRDATE read the correct date, but for ENRDATE1, the year add >a '0' and remove the last digit of the year to the next var. I don't know >why and how to deal with this. So if you can provide your helpful advice, it >would be apprecited pretty much. Thanks! > >James >______________________________________________________ >Get Your Private, Free Email at http://www.hotmail.com

The apparent confusing result has various causes

* mixing input styles can cause confused input DSD implies variable width data using delimiters to separate columns so use list input *without* informats in the input statement - those informats can be provided on an informat statement.

* Not only have you comma delimiters, but also a blank - there are easier solutions than using : or & before informats -- If you always have data in the columns, you can replace DSD with DLM= and use both blank and comma as your delimiters with this infile statement infile file1 dlm = ' ,' ;

* variable width needs support for short data in the last column -- it isn't a problem here, but accompany DSD and DLM= with TRUNCOVER on your infile statement and you'll avoid that trouble

* you haven't set your YEARCUTOFF option and it defaults to 1900

Good luck, and try all the options.....

-- Peter Crawford


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