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 (May 2004, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 20 May 2004 09:01:47 -0700
Reply-To:   "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Subject:   Re: Import CSV file, variable field numbers
Comments:   To: "ben.powell@cla.co.uk" <ben.powell@cla.co.uk>
Content-Type:   text/plain; charset="iso-8859-1"

Can't resist myself really - mine was a bit of an old banger, but it was better than a slap in the face with a wet kipper. I'd just love to tonk it up the motorway. ;-)

If you replace the cards reference on your infile statement with your fileref and also delete the cards statement and inline data, then the program should work exactly the same, except for pointing at the file rather than the inline cards. The extra array in the second datastep should not matter, it's just a different way of handling the data.

I placed your data into data.txt (you'll need a path or put it in your default directory) and it ran just like you want:

data pars; infile 'data.txt' dsd missover; input (feild1-feild3) (: $50.) ; if feild1='' then delete; run; data pars(drop=feild1-feild3 i j); retain isbn det1-det30 j; set pars end=eod; length isbn $ 10 det1-det30 $ 50; array det(30) det1-det30; array fld(3) feild1-feild3; if feild1=:'ISBN' then do; if _n_>1 then output; isbn=scan(feild1,3,' '); do j=1 to 30; det(j)=' '; end; j=0; end; else do; do i=1 to 3; det(i+j)=fld(i); end; j+3; end; if eod then output; run;

good luck Ben.

Paul Choate DDS Data Extraction (916) 654-2160 -----Original Message----- From: Ben Powell [mailto:Ben.powell@cla.co.uk] Sent: Thursday, May 20, 2004 2:20 AM To: 'Choate, Paul@DDS'; SAS-L@LISTSERV.UGA.EDU Subject: RE: Import CSV file, variable field numbers

Yeah ok enough of the English jokes already, go eat some to-mate-os :-) Nice car by the way. Shame they never did a V10 8 litre (something in cubic inches) SUV variant!   ...   Is the only way to get this to work to use cards? There are 14,000 lines in the csv. Using dsd with a conventional infile scuppers the latter part of the program as the array can no longer be used to parse the additional fields.   Thanks also for adding another array into the bargain and confusing me even more!   Ben.


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