| Date: | Tue, 19 Jun 2007 13:35:06 -0700 |
| Reply-To: | "Terjeson, Mark" <Mterjeson@RUSSELL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Terjeson, Mark" <Mterjeson@RUSSELL.COM> |
| Subject: | Re: tilda(~) delimited file |
|
| In-Reply-To: | A<200706192021.l5JIGr9N004037@mailgw.cc.uga.edu> |
| Content-Type: | text/plain; charset="US-ASCII" |
Hi Ran,
* make sample data ;
data _null_;
file 'c:\temp\abc.txt';
put 'Name~Age~Gender~Amt1~Amt2';
put '"Alfred"~14~"M"~69~112.5';
put '"Alice"~13~"F"~56.5~84';
put '"Barbara"~13~"F"~65.3~98';
put '"Carol"~14~"F"~62.8~102.5';
put '"Henry"~14~"M"~63.5~102.5';
run;
PROC IMPORT OUT=WORK.abc
DATAFILE="C:\TEMP\abc.txt"
DBMS=DLM REPLACE;
DELIMITER='~';
GETNAMES=YES;
DATAROW=2;
RUN;
/*
You can also use the Import Wizard, which
is where I got the code above. If you pick
a data source type of "Delimited (*.*)",
when you get to the second page asking for
where is the file located click on the Options
command button and pick any character you want
to delimit on.
*/
/*
or for data step INFILE/INPUT method
you can check out the options DSD and
DLM='~' for those statements.
*/
Hope this is helpful.
Mark Terjeson
Senior Programmer Analyst, IM&R
Russell Investments
Russell Investments
Global Leaders in Multi-Manager Investing
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Ran
S
Sent: Tuesday, June 19, 2007 1:21 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: tilda(~) delimited file
Hi,
I have a tilda(~) delimited file, How can I convert this file to sas
dataset?
Thanks in advance!
|