BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
n6
Quartz | Level 8 n6
Quartz | Level 8

I'm using proc import for a .txt file and the delimiter in it is |.

 

My DBMS line had been DBMS = TAB REPLACE; but that does not work with the | delimiter.

 

I've also tried

 

DBMS = DLM  = '|' REPLACE;

 

DBMS = DLM REPLACE;

 

DBMS = '|' REPLACE;

 

None of them work.  Anyone with any idea what would work?  Any info is appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
proc import datafile="path to your txt file" out=mydata dbms=dlm replace;
   delimiter="|";
   getnames=yes;
run;

@n6 wrote:

I'm using proc import for a .txt file and the delimiter in it is |.

 

My DBMS line had been DBMS = TAB REPLACE; but that does not work with the | delimiter.

 

I've also tried

 

DBMS = DLM  = '|' REPLACE;

 

DBMS = DLM REPLACE;

 

DBMS = '|' REPLACE;

 

None of them work.  Anyone with any idea what would work?  Any info is appreciated.


 

View solution in original post

3 REPLIES 3
Reeza
Super User
proc import datafile="path to your txt file" out=mydata dbms=dlm replace;
   delimiter="|";
   getnames=yes;
run;

@n6 wrote:

I'm using proc import for a .txt file and the delimiter in it is |.

 

My DBMS line had been DBMS = TAB REPLACE; but that does not work with the | delimiter.

 

I've also tried

 

DBMS = DLM  = '|' REPLACE;

 

DBMS = DLM REPLACE;

 

DBMS = '|' REPLACE;

 

None of them work.  Anyone with any idea what would work?  Any info is appreciated.


 

n6
Quartz | Level 8 n6
Quartz | Level 8

It works.  Beautiful.  Thank you.

ballardw
Super User

@n6 wrote:

I'm using proc import for a .txt file and the delimiter in it is |.

 

My DBMS line had been DBMS = TAB REPLACE; but that does not work with the | delimiter.

 

I've also tried

 

DBMS = DLM  = '|' REPLACE;

 

DBMS = DLM REPLACE;

 

DBMS = '|' REPLACE;

 

None of them work.  Anyone with any idea what would work?  Any info is appreciated.


What did you log show? Expect several different errors.

The example from the documentation gives you pretty clear example:

proc import datafile=<your filename goes here>
        dbms=dlm
        out=<your data set name goes here>
        replace;

     delimiter='|';
     getnames=yes;
run;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1700 views
  • 0 likes
  • 3 in conversation