BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Aexor
Lapis Lazuli | Level 10

I want to read values from mytext file

 

mytext

RamabcSamabcKaleabc

 

How to read data this type of file. Please advise.

Also please let me know if i can specify string in dlm option

for e.g dlm='abc'

 

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hello @Aexor,

 

You can specify strings as delimiters in the DLMSTR= option of the INFILE statement:

/* Create test file for demonstration */

filename myfile temp; 

data _null_;
file myfile;
put 'RamabcSamabcKaleabc';
run;

/* Read the test file */

data want;
infile myfile dlmstr='abc';
input (var1-var3)($);
run;

View solution in original post

2 REPLIES 2
FreelanceReinh
Jade | Level 19

Hello @Aexor,

 

You can specify strings as delimiters in the DLMSTR= option of the INFILE statement:

/* Create test file for demonstration */

filename myfile temp; 

data _null_;
file myfile;
put 'RamabcSamabcKaleabc';
run;

/* Read the test file */

data want;
infile myfile dlmstr='abc';
input (var1-var3)($);
run;
Aexor
Lapis Lazuli | Level 10
Awesome! I didn't new there is such thing like dlmstr
thanks much 🙂

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
  • 2 replies
  • 341 views
  • 7 likes
  • 2 in conversation