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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 2424 views
  • 0 likes
  • 3 in conversation