BookmarkSubscribeRSS Feed
manoj_pandey
Fluorite | Level 6

I have data in .txt file ,where each word is separated by single space like below.

mayoflstat mayolc accrual mayolc

 

Now I would like to read the .txt file and create a single variable having the below values.

 

Text

mayoflstat

mayolc

accrual

mayolc

 

data test;
INFILE '/home/rpv/var.txt' dlm =" " ;
INPUT Text  $1000.;
RUN;

 

I there any options need to add the above code to get the required result? or need to update the code.

 

Thank you in advance.

 

3 REPLIES 3
manoj_pandey
Fluorite | Level 6

It's worked. Thank you

ShiroAmada
Lapis Lazuli | Level 10

Try this

data test;
  infile "<your path here>" truncover;
  input var $30. @;
  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
  • 770 views
  • 2 likes
  • 3 in conversation