LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (November 2006, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 30 Nov 2006 16:00:39 -0500
Reply-To:   "data _null_;" <datanull@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "data _null_;" <datanull@GMAIL.COM>
Subject:   Re: How to Create Pipe Delimited flat files
Comments:   To: "Terjeson, Mark" <Mterjeson@russell.com>
In-Reply-To:   <16FD64291482A34F995D2AF14A5C932C015A6E63@MAIL002.prod.ds.russell.com>
Content-Type:   text/plain; charset=ISO-8859-1; format=flowed

Oh now I get it. I did not understand that bit about alignment. So if you are going to line everything up (formatted put) why do you need a delimiter.

That said the solution you supplied seems reasonable for an unreasonable request.

On 11/30/06, Terjeson, Mark <Mterjeson@russell.com> wrote: > Hi data null, > > That is another method of applying formats > but can you somehow make it preserve the > fix lengths that the user desired? A number > of the solutions so far do indeed place a > vertical bar delimiter inbetween the values. > The user also needed to preserve the fixed > widths and the trialing spaces therein. > > Have ya got a clever adjustment to the format > modifiers scheme to maintain the fixed widths? > > Mark > > > > -----Original Message----- > From: data _null_; [mailto:datanull@gmail.com] > Sent: Thursday, November 30, 2006 11:15 AM > To: Terjeson, Mark > Cc: SAS-L@listserv.uga.edu > Subject: Re: How to Create Pipe Delimited flat files > > Thats because your PUT statement is using FORMATTED put. Try it with > the : format modifier. Delimited output implies LIST put. > > 64 data _null_ ; > 65 set sashelp.class; > 66 file log dlm = "|" dsd; > 67 put (name sex age) (:$8 :$4. :3.); > 68 run; > > A|M|14 > A|F|13 > B|F|13 > C|F|14 > H|M|14 > J|M|12 > J|F|12 > J|F|15 > J|M|13 > J|M|12 > J|F|11 > J|F|14 > L|F|12 > M|F|15 > P|M|16 > R|M|12 > R|M|15 > T|M|11 > W|M|15 > > > On 11/30/06, Terjeson, Mark <Mterjeson@russell.com> wrote: > > Hi Kevin, > > > > When the format is there the dlm character does not seem to get > > attached, and when the @positioning is there it also does not seem to > > get attached. When all else fails, you could do it manually and have > > the formats you desire. e.g. > > > > > > data _null_ ; > > set sashelp.class; > > file "c:\temp\test1.txt" dlm = "|" dsd; put > > name $8. '|' > > sex $4. '|' > > age 3. > > ; > > run; > > > > > > > > Hope this is helpful. > > > > > > Mark Terjeson > > Senior Programmer Analyst, IM&R > > Russell Investment Group > > > > > > Russell > > Global Leaders in Multi-Manager Investing > > > > > > > > > > > > -----Original Message----- > > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of > > SUBSCRIBE SAS-L Chandra Gadde > > Sent: Thursday, November 30, 2006 10:17 AM > > To: SAS-L@LISTSERV.UGA.EDU > > Subject: Re: How to Create Pipe Delimited flat files > > > > Hi Kevin, > > > > Thank you for the reply. This works fine. But I have 66 columns that > are > > of different lengths. Here is the sample data. > > > > column1 column2 column3 > > ccbase 009875 10VB > > kkloa 0092 11RM > > ggma 09632 49RTY > > aadail 002368 32UIER > > > > Now this is what I want. > > ccbase|009875|10VB > > kkloa |0092 |11RM > > ggma |09632 |49RTY > > aadail|002368|32UIER > > > > The code you sent me works like this. > > ccbase|009875|10VB > > kkloa|0092|11RM > > ggma|09632|49RTY > > aadail|002368|32UIER > > > > I am trying this code. But it is not displaying the Pipe delimits. > > Please help me. > > > > data _null_ ; > > set test1; > > file "c:\test1.txt" dlm = "|" dsd; > > put > > @01 column1 $06. > > @08 column2 $13. > > @15 column3 $20 > > ; > > run ; > > > > > > >On Thu, 30 Nov 2006, SUBSCRIBE SAS-L Chandra Gadde wrote: > > > > > I am using Mainframe SAS where I have a dataset of 66 columns and > > > almost a million records. I need to create a flat file that is pipe > > delimited. > > Could > > > you please help me how to make a flat file with pipe delimited from > a > > > sas dataset. > > > > >Give this a look: > > > > >data _null_ ; > > > file "~/pipe.csv" dlm = "|" dsd ; > > > put var1-var66 ; > > >run ; > > > > >Kevin > > > > Kevin Viel > > PhD Candidate > > Department of Epidemiology > > Rollins School of Public Health > > Emory University > > Atlanta, GA 30322 > > >


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