Date: Fri, 14 Dec 2007 08:03:28 -0500
Reply-To: Nathaniel.Wooding@DOM.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Nat Wooding <Nathaniel.Wooding@DOM.COM>
Subject: Re: Pb to import date into a SAS datamart
In-Reply-To: <5890051b-02bd-40de-9e4f-9b3cfb38dadb@d21g2000prf.googlegroups.com>
Content-Type: text/plain; charset="US-ASCII"
Manie
An addendum to Andre's comments.
I did not see that he mentioned it but your variable
ase_start_date
is spelled
ase_strat_date in the input statement.
Also, you specify a character informat for cust_nr but then have
if cust_nr not = .;
Here, sas expect cust_nr to be a numeric variable since you ask do delete
the obs when it value of cust_nr is missing. If all of the instances of the
variable are numeric, you can either specify a numeric informat (say 8.) or
simply delete the informat statement and SAS will automatically read it as
a numeric variable.
Nat Wooding
Environmental Specialist III
Dominion, Environmental Biology
4111 Castlewood Rd
Richmond, VA 23234
Phone:804-271-5313, Fax: 804-271-2977
manie
<baroux.s@MAC.COM
> To
Sent by: "SAS(r) SAS-L@LISTSERV.UGA.EDU
Discussion" cc
<SAS-L@LISTSERV.U
GA.EDU> Subject
Pb to import date into a SAS
datamart
12/14/2007 03:58
AM
Please respond to
manie
<baroux.s@MAC.COM
>
Hello,
I try to import a flat file tab delimited file into a SAS datamart and
receive errors on data fields/
The source file is like this:
100098 abc informatique 1/02/04 1/09/06
100099 abc informatique2 1/02/05 21/12/06
I run the code:
data emeawork.dataset_test;
infile "c:\file_test.txt" delimiter = '09'x firstobs = 1 lrecl=1000;
informat cust_nr $10.;
informat ase_start_date ddmmyy6.;
informat ase_end_date ddmmyy6.;
input
cust_nr
ase_strat_date
ase_end_date;
if cust_nr not = .;
run;
if cust_nr not = .;
I receive an error: "invalid format for ase_start_date in line "
I've tried with format ddmmyy8. and with the fomat in the "input"
instead of "informat" but I receive the same error.
Can you help me to find the right syntax?
Thanks
Stephanie
-----------------------------------------
CONFIDENTIALITY NOTICE: This electronic message contains
information which may be legally confidential and/or privileged and
does not in any case represent a firm ENERGY COMMODITY bid or offer
relating thereto which binds the sender without an additional
express written confirmation to that effect. The information is
intended solely for the individual or entity named above and access
by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying, distribution, or use of the
contents of this information is prohibited and may be unlawful. If
you have received this electronic transmission in error, please
reply immediately to the sender that you have received the message
in error, and delete it. Thank you.