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 (March 2007, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 29 Mar 2007 16:29:28 -0400
Reply-To:   Nirmal kumar <lazybone2k@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Nirmal kumar <lazybone2k@GMAIL.COM>
Subject:   Re: Value missing at the end of the raw datafile record
Comments:   To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@howles.com>
In-Reply-To:   <200703290025.l2SMhND8011383@mailgw.cc.uga.edu>
Content-Type:   text/plain; charset=ISO-8859-1; format=flowed

The problem with the missing values is with the UNIX way of handling the file/record struture.PC uses <CR><LF> (Carriage Return/Line Feed) to terminate records where UNIX only uses the <LF>.So, ven though the various fields are separated by comma in unix. It still has the unix <LF> as the end of the record.

I used the ascii character for the ',' and <LF> as a dlm and the program works fine.

dlm='2C0D'x Anyways thanks for the input Listers.......

Cheer, Kumar

On 3/28/07, Howard Schreier <hs AT dc-sug DOT org> <nospam@howles.com> wrote: > > On Mon, 26 Mar 2007 12:21:10 -0400, SAS-L Nirmal <lazybone2k@GMAIL.COM> > wrote: > > >Dear SAS - L Users, > > > >In a reply to my previous post, Howard helped me with the following code > to > >read a logically designed raw datafile. The code below created 2 tables > >from the raw datafile - Id and desc. The raw datafile starts with a > summary > >about the dimensions and then it is followed by Id values and description > >of the dimensions and the various levels. Id values are arranged in > record > >by record format. > > > >If product has 30 levels- all the 30 ids are arranged in groups of 10 > >values or fields such as > >id1,id2,....id10, > >id11,id12...id20, > >id21,id22...id30, format. but the descriptions are arranged in line by > >line format. > > > >The code works fine when the id values dont extend beyond one record. If > it > >extends to the next, there are some missing values in the Id table. I > >understand these missing values are generated because SAS searches for > the > >next value when it reaches the 10th field and return a missing value and > >then goes to the next line... > > > >Is there any way to rectify this....any tips and suggestion will be > helpful. > > Get rid of the comma at the end of each line. Each comma implies the > existence of an additional field, which of course yields a missing value. > > Or include program logic which persists in reading a variable until a > non-missing value is found. > > > > >Thanks once again. > > > >*************************sample code********************* > > > >data id (keep = dnumber dimname i id) > > desc(keep = dnumber dimname i desc); > > infile cards dlm=',' ; > >length ldesc $80.; > >Length sdesc $40.; > > array dname(99) $ _temporary_; > > array dsize(99) _temporary_; > > do dnumber = 1 to 5; > > input dname(dnumber) dsize(dnumber); > > end; > > do dnumber = 1 to 5; > > dimname = dname(dnumber); > > do i = 1 to dsize(dnumber); > > input id $ @; > > output id; > > end; > > input; > > end; > > do dnumber = 1 to 5; > > dimname = dname(dnumber); > > do i = 1 to dsize(dnumber); > > input ldesc $ sdesc $; > > output desc; > > end; > > end; > > input; > >cards; > >Mrkt,1, > >BGrp,1, > >Prod,5, > >Facts,30, > >Per,2, > >M11, > >B10100, > >P1330897,P1330932,P1330938,P1330962,P1330966, > >F3101,F3102,F3105,F3106,F3395,F3396,F3397,F3398,F5511,F5512, > >F5513,F5514,F5515,F5516,F5517,F5518,F5519,F5520,F5521,F5500, > >F5501,F5502,F5503,F5504,F5505,F5506,F5507,F5508,F5509,F5510, > >JA2503004,FB2203004, > >TOTAL U.S.,TOTAL U.S., > >Buyers, Buyers, > >FRUIT,FRUIT, > >CONFECTION,CONFECTION, > >NABISCO,NABISCO, > >MCKEE,MCKEE, > >PL/GEN,PL/GEN, > >Population,Population, > >Base,Base, > >Current Per,Current Per, > >Volume,Volume, > >Transactions,Transactions, > >code Transactions,Raw code Transactions, > >Category Buyers,Category Buyers, > >code Buyers,code Buyers, > >Trial (Pop),Trial (Pop), > >1 (Pop),1 (Pop), > >2 (Pop),2 (Pop), > >3 (Pop),3 (Pop), > >4 (Pop),4 (Pop), > >5 (Pop),5 (Pop), > >6 (Pop),6 (Pop), > >7 (Pop),7 (Pop), > >8 (Pop),8 (Pop), > >9 (Pop),9 (Pop), > >10+ (Pop),10+ (Pop), > >Trial (Trier),Trial (Trier), > >1 (Trier),1 (Trier), > >2 (Trier),2 (Trier), > >3 (Trier),3 (Trier), > >4 (Trier),4 (Trier), > >5 (Trier),5 (Trier), > >6 (Trier),6 (Trier), > >7 (Trier),7 (Trier), > >8 (Trier),8 (Trier), > >9 (Trier),9 (Trier), > >10+ (Trier),10+ (Trier), > >12/29/02 - 01/25/03,12/29/02 - 01/25/03, > >01/26/03 - 02/22/03,01/26/03 - 02/22/03, > >; > >run; > > > > > >************************************************************ >


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