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 (December 2008, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 18 Dec 2008 12:09:44 -0800
Reply-To:     shiling99@YAHOO.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Shiling Zhang <shiling99@YAHOO.COM>
Organization: http://groups.google.com
Subject:      Re: Space and Double-tilda( ~~) delimited file
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

On Dec 18, 2:46 pm, baymanl <baym...@gmail.com> wrote: > Hi all, > > We obtained some datasets from a third party and the data are > delimited with space-tilda-tilda ( ~~), and some (but not all) missing > entries are underscores (_). I cannot import them into SAS properly. > What I have tried: > > 1 - importing directly into SAS. If I do this by indicating the > delimiter is " ~~" then I get one extra column for each second tilda. > (160 variables instead of 80). Also many errors due to ~ and _'s. > > 2 - import to Access -> import to SAS. I get better structure, only > couple empty columns, but almost all the variables are 255 character > long. > > 3 - open the data in a text editor -> find/replace " ~~" with commas, > replace _ with space -> import to SAS as CSV. It's the most > cumbersome, but seems like the best way. Except, I cannot indicate > some variables are in fact texts (patients ID numbers, etc), and they > are in numeric format after importing which creates problems with the > current SAS codes. > > Have you had any similar problem, and how did you manage importing? > > Thanks a lot. > > L You may consider to write your own inport pgm. Here is an example and you can modify it for your use. data t1; length x $1; infile cards delimiter=' ~' truncover; input x y z; cards; 1 ~~2 1 ~~_ ~~3 1 ~2 ~~3 1 2 3 1~2~3 ;

proc print; run;


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