×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

comma delimited

comma delimited

comma delimited

(OP)
I uploaded a .CSV file and it now has double quotes and periods in it so I'm trying to read it in as a delimited file to no avail.  I have data that looks like:
.~".R.o.w. .#.".,.".S.D.A.T.E.".,.".L.E.V.E.L.1.".,.".L.E.V.E.L.2.".,.".S._.P.R.
.".1.".,.".0.8./.3.0./.2.0.1.0.".,.".0.0.0.0.1.1.5.0.".,.".L.E.G.:.7.7.7.".,."."
.".2.".,.".0.8./.3.0./.2.0.1.0.".,.".0.0.0.0.1.1.5.0.".,.".L.E.G.:.7.8.1.".,."."
.".3.".,.".0.8./.3.0./.2.0.1.0.".,.".0.0.0.0.1.2.5.0.".,.".L.E.G.:.7.7.0.".,."."
.".4.".,.".0.8./.3.0./.2.0.1.0.".,.".0.0.0.0.1.2.5.0.".,.".L.E.G.:.7.7.5.".,."."
.".5.".,.".0.8./.3.0./.2.0.1.0.".,.".0.0.0.0.1.2.5.0.".,.".L.E.G.:.7.7.7.".,."."
.".6.".,.".0.8./.3.0./.2.0.1.0.".,.".0.0.0.0.1.2.5.0.".,.".L.E.G.:.7.8.1.".,."."
.".7.".,.".0.8./.3.0./.2.0.1.0.".,.".0.0.0.0.1.2.6.0.".,.".L.E.G.:.7.7.0.".,."."
.".8.".,.".0.8./.3.0./.2.0.1.0.".,.".0.0.0.0.1.2.6.0.".,.".L.E.G.:.7.7.6.".,."."
.".9.".,.".0.8./.3.0./.2.0.1.0.".,.".0.0.0.0.1.2.6.0.".,.".L.E.G.:.7.7.7.".,."."
.".1.0.".,.".0.8./.3.0./.2.0.1.0.".,.".0.0.0.0.1.2.6.0.".,.".L.E.G.:.7.8.1.".,."
.".1.1.".,.".0.8./.3.0./.2.0.1.0.".,.".0.1.0.0.1.2.5.0.".,.".L.E.G.:.7.7.0.".,."
.".1.2.".,.".0.8./.3.0./.2.0.1.0.".,.".0.1.0.0.1.2.5.0.".,.".L.E.G.:.7.7.5.".,."
.".1.3.".,.".0.8./.3.0./.2.0.1.0.".,.".0.1.0.0.1.2.5.0.".,.".L.E.G.:.7.7.7.".,."
.".1.4.".,.".0.8./.3.0./.2.0.1.0.".,.".0.1.0.0.1.2.5.0.".,.".L.E.G.:.7.8.1.".,."
.".1.5.".,.".0.8./.3.0./.2.0.1.0.".,.".0.1.0.0.2.1.9.5.".,.".L.E.G.:.7.7.0.".,."
.".1.6.".,.".0.8./.3.0./.2.0.1.0.".,.".0.1.0.0.2.1.9.5.".,.".L.E.G.:.7.7.5.".,."
.".1.7.".,.".0.8./.3.0./.2.0.1.0.".,.".0.1.0.0.2.1.9.5.".,.".L.E.G.:.7.7.6.".,."
.".1.8.".,.".0.8./.3.0./.2.0.1.0.".,.".0.1.0.0.2.1.9.5.".,.".L.E.G.:.7.7.7.".,."

and my sas to read it in looks like:
DATA A;
INFILE FCST12C DLM=',' LRECL=100 FIRSTOBS=2;
INPUT
   ROW:$20.
   FDATE:$27.
   NAV_PN $
   PDC $
   OLDFCST $
   CURFCST $
   RCRDTYPE $
   ;

Is there a way to get rid of the double quotes and the periods in the infile statement?

RE: comma delimited


Here is code, try this-

data a1;
set a;
row = compress (row, '" " ');
fdate= compress (fdate, '" " ');
nav_pn= compress (nav_pn, '" "');
pdc= compress (pdc, '" "');
oldfcst= compress (oldfcst, '" "');
curfcst= compress (curfcst, '" "');
rcrdtype= compress (rcrdtype, '" "');
run;

RE: comma delimited

And for periods you can use same method, instead of " " you should put .
  

RE: comma delimited

here is total code-

data a1;
set a;
row = compress (row, '" " ');
fdate= compress (fdate, '" " ');
nav_pn= compress (nav_pn, '" "');
pdc= compress (pdc, '" "');
oldfcst= compress (oldfcst, '" "');
curfcst= compress (curfcst, '" "');
rcrdtype= compress (rcrdtype, '" "');
run;

data a1;
set a1;
row = compress (row, '.. .. ');
fdate= compress (fdate, '.. .. ');
nav_pn= compress (nav_pn, '.. ..');
pdc= compress (pdc, '.. ..');
oldfcst= compress (oldfcst, '.. ..');
curfcst= compress (curfcst, '.. ..');
rcrdtype= compress (rcrdtype, '.. ..');
run;

RE: comma delimited

(OP)
Ah, compress.  Why didn't I see that?  Thanks!  This works!

CODE

ROW = COMPRESS(COMPRESS(ROW, '"'), '00'X);
FDATE = COMPRESS(COMPRESS(FDATE, '"'), '00'X);
NAV_PN = COMPRESS(COMPRESS(NAV_PN, '"'), '00'X);
PDC = COMPRESS(COMPRESS(PDC, '"'), '00'X);
OLDFCST = COMPRESS(COMPRESS(OLDFCST, '"'), '00'X);
CURFCST = COMPRESS(COMPRESS(CURFCST, '"'), '00'X);
RCRDTYPE = COMPRESS(COMPRESS(RCRDTYPE, '"'), '00'X);

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close