Go Back   Rhinocerus > Newsgroup > Newsgroup comp.soft-sys.sas

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 06-03-2005, 06:44 PM
Terjeson, Mark
Guest
 
Posts: n/a
Default Re: Reading MMDDYY date values from EBCDIC into ASCII

Hi Talbot,

Your two step method of inputting and converting
with the ebcdic informat and then separately
converting to date with the date format is
indicative that there are two convertions needed.
("format upon another format" would be a cute idea)

One other way is the flip the file, such as:

* flip text file from EBCDIC to ASCII ;
filename thefile 'c:\temp\sample.txt';
data _null_;
infile thefile recfm=f lrecl=1;
file thefile recfm=f lrecl=1;
input char $ebcdic1.;
put char $char1.;
run;

and then use the input statement with mmddyy10.
and the other desired formats in a datastep.



just for fun, here is the opposite flavor:

* flip text file from ASCII to EBCDIC ;
filename thefile 'c:\temp\sample.txt';
data _null_;
infile thefile recfm=f lrecl=1;
file thefile recfm=f lrecl=1;
input char $char1.;
put char $ebcdic1.;
run;




Hope this is helpful.


Mark Terjeson
Senior Programmer Analyst, IM&R
Russell Investment Group


Russell
Global Leaders in Multi-Manager Investing






-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Talbot Michael Katz
Sent: Friday, June 03, 2005 10:22 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Reading MMDDYY date values from EBCDIC into ASCII


Hi.

I have an EBCDIC flat file with date strings as follows: 03/16/2002

If I were staying within the EBCDIC environment, I could read this
directly into a SAS date field with: input @1 datevar mmddyy10.;

But that doesn't work in my case, because I'm reading the file into an
ASCII environment. Of course, I can do: input @1 datevarc $ebcdic10.;
datevar = input(datevarc,mmddyy10.);

But is there a way to read the raw data directly into a date variable
with the input statement?


To extend the issue further, if I am creating my own informat, is there
a way to define it so that it does EBCDIC to ASCII automatically in the
input statement, or do I always have to read the field into a character
string with $EBCDICw. and then convert with the input() function?


************************************************** ******************

And, for a "heads-up," in a related matter, I have some "default" date
values of: 01/01/0001

Even though these actually have a four-character year, when I read them
into a date variable with the input function, it makes them into January
1st, 2001. Of course, this can be worked around by resetting the
YEARCUTOFF option, or by using conditional logic.

************************************************** ******************


Thanks!

-- TMK --
"The Macro Klutz"
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: SAS Negative Date Values Daniel Nordlund Newsgroup comp.soft-sys.sas 0 12-08-2008 08:00 AM
Re: Reading a date from an EBCDIC file on PC Schwarz, Barry A Newsgroup comp.soft-sys.sas 0 10-09-2007 09:33 PM
Merge Help-Exception File jamesgreen55@yahoo.ca Newsgroup comp.soft-sys.sas 3 06-06-2006 06:30 PM
Re: Formating missing values in date column Madan Gopal Kundu Newsgroup comp.soft-sys.sas 0 04-20-2006 05:32 AM
Re: Date Comparisons with Proc SQL. Pardee, Roy Newsgroup comp.soft-sys.sas 0 01-07-2005 07:39 PM



All times are GMT. The time now is 04:45 AM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.