Date: Wed, 9 Mar 2011 09:16:46 -0500
Reply-To: Nuria Chapinal <nchapinal@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Nuria Chapinal <nchapinal@YAHOO.COM>
Subject: Re: problems importing datetimes from csv files
I am still having trouble understanding what this loop of the code does,
though. I know what the calf = input(etc...) does because I created it. It
is taking a bit of the filename.... but the loop itself... I can't figure
it out....
input @;
if _n_ eq 1 or eov then do;
calf =input( scan (input (scan(fname,-1,'_'), $12.),1), 12.);
retain filename calf;
eov = 0;
input #2;
delete;
end;
in the final code:
filename FT46F001 'C:\Users\nuria\Desktop\hobo\c\*.csv' lrecl=256;
data nc;
length fname $256;
infile FT46F001 dlm=',' dsd eov=eov filename=fname truncover ;
input @;
if _n_ eq 1 or eov then do;
calf =input( scan (input (scan(fname,-1,'_'), $12.),1), 12.);
retain filename calf;
eov = 0;
input #2;
delete;
end;
input obs: 9. dtx:$30. (y z) (:9.) ;
date= input(scan(dtx,1,' '),ddmmyy8.);
time = input (substr (dtx, 10, 14), time12.);
format date date.;
format time time.;
hour =hour (time);
run;
|