LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2001, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 3 Oct 2001 10:57:47 -0700
Reply-To:   "Terjeson, Mark" <TerjeMW@DSHS.WA.GOV>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Terjeson, Mark" <TerjeMW@DSHS.WA.GOV>
Subject:   Re: Text File Import Problem
Comments:   To: Mike Stuart <muon33@NYC.RR.COM>
Content-Type:   text/plain; charset=iso-8859-1

Hi Mike,

* make sample data ; data _null_; file 'c:\temp\abc.txt'; put 'test1@dkadk.com'; put '3234dk@efg.com'; put 'jieuw@lmdkadk.com'; put '3234dk@efg.com'; run;

* Read variable line length flat file ; data table1(keep=myline); length myline $ 200; infile 'c:\temp\abc.txt' length=lenvar; input @1 myline $varying. lenvar; run;

* adding your goodies ; data table1(keep=email domain); length email $ 50; infile 'c:\temp\abc.txt' length=lenvar; input @1 email $varying. lenvar; email = left(trim(lowcase(email))) ; domain = substr(email,(index(email,'@')+1)) ; run;

* another variation using SCAN() ; * to replace INDEX() and SUBSTR() ; data table1(keep=email domain); length email $50; infile 'c:\temp\abc.txt' length=lenvar; input @1 email $varying. lenvar; email = left(trim(lowcase(email))) ; domain = scan(email,2,'@') ; run;

Hope this is helpful, Mark Terjeson Washington State Department of Social and Health Services Division of Research and Data Analysis (RDA) mailto:terjemw@dshs.wa.gov

-----Original Message----- From: Mike Stuart [mailto:muon33@NYC.RR.COM] Sent: Wednesday, October 03, 2001 9:29 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Text File Import Problem

Having problems with a straight-forward import, I think the problem has to do with non-viz characters, but I'm not sure. When viewed, the file I'm trying to read in is relatively straight-forward, one email address per line. I'm using the code below to read in this file.

data ffx.epilist ; infile epilist truncover ; input @1 email $50. ;

email = left(trim(lowcase(email))) ;

domain = substr(email,(index(email,'@')+1)) ;

run ;

The output however looks like this:

obs email domain 1 test1@dkadk.com 3234dk@efg.com jieuw@lm dkadk.com 3234dk@efg.com

etc.

It looks like the line delimiter is missing. Suggestions on how to fix? I've tried the import wizard using a number of different delimiter option and am getting the same result.

Thanks -


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