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 (January 2009, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 5 Jan 2009 12:59:40 -0600
Reply-To:   Joe Matise <snoopy369@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Joe Matise <snoopy369@GMAIL.COM>
Subject:   Re: importing lots of text from Excel
Comments:   To: Tiffany <tiffany.vidal@gmail.com>
In-Reply-To:   <cfc3732a-a168-4cb7-8fa9-10f2fbaff101@a29g2000pra.googlegroups.com>
Content-Type:   text/plain; charset=ISO-8859-1

If it's a CSV (which is distinct from an 'excel file' which to most of us means .xls or .xlsx/m/b) then you should just need to adjust the informat and format length, i'd think. Maybe 200 is not enough? Or, maybe you are only showing the first so many characters due to the format? You can have thousands of chars in a field, after all.

Usually the best thing to do is either to infile input without delim, and just read the whole line into one variable, and see what it comes in as - a variable with length equal to the maximum line length, so 50000 or whatever - or, open it in textpad/editplus/etc. and see what it looks like there (a text editor that has row-column listed somewhere). That will tell you a lot about it, particularly how long you need to make the variables.

If you need to get rid of the spaces, once you get it in with a large variable, you should be able to trim it (using compress or compbl, or trim, or left/right).

If this doesn't help, could you perhaps paste a few lines of this data (or, something that behaves identically but is not proprietary/hipaa covered) into a message?

-Joe

On Mon, Jan 5, 2009 at 12:40 PM, Tiffany <tiffany.vidal@gmail.com> wrote:

> On Jan 5, 12:52 pm, ajayo...@yahoo.com (ajay ohri) wrote: > > copy and paste..use dde if need to automate > > > > --- On Mon, 1/5/09, Tiffany <tiffany.vi...@GMAIL.COM> wrote: > > > > > From: Tiffany <tiffany.vi...@GMAIL.COM> > > > Subject: importing lots of text from Excel > > > To: SA...@LISTSERV.UGA.EDU > > > Date: Monday, January 5, 2009, 11:09 PM > > > Hi everyone, > > > > > I am trying to import an Excel file with two fields that > > > have > > > comments. These can be null up to a paragraph or so. I > > > have tried a > > > straight proc import as well as an infile statement > > > assigning these > > > fields a format of $200. Neither seems to work. I get > > > maybe the > > > first 10 characters in the field. Does anyone have a > > > suggestion on > > > how to do this properly? > > > > > thank you for your help!! > > > > > Tiffany/ > > ************************************************************************ > Using DDE: > I tried the following statement. The data were imported, but the > comment fields were still truncated. The comments are in columns A, B > and C. > > OPTIONS NOXSYNC NOXWAIT; > X '"C:/interviews/interview_24NOV08.csv"'; > filename goods DDE 'Excel|W:/interviews/[interview_24NOV08.csv] > interview_24NOV08!R1C1:R28C6'; > data inter; > INFILE goods NOTAB DLM='09'x DSD MISSOVER lrecl=50000; > informat FIELD_NAME $20.; > informat FIELDS $30.; > informat EXAMPLE $20.; > informat A $200.; > informat B $200.; > informat C $200.; > > input FIELD_NAME $ FIELDS $ EXAMPLE $ A $ B $ C $; > run; >


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