BookmarkSubscribeRSS Feed
dio
Calcite | Level 5 dio
Calcite | Level 5

Hello all,

i have a .txt document with several million lines and I need to create a separate text files for each of these lines of text. So, the point is to end up with several million files, each containing one line of text, in a folder named Texts. Anyone have an idea how do this?

Thanks,

Dan

2 REPLIES 2
data_null__
Jade | Level 19

I'm not sure this is a good idea.

data _null_;

   if _n_ eq 1 then rc = DCREATE('Texts','.');

   infile cards;

   input;

   filename = cats('.\texts\temp',put(_n_,z12.),'.txt');

   file dummy filevar=filename;

   put _infile_;

   cards4;

Hello all,

i have a .txt document with several million lines and

I need to create a separate text files for each of these

lines of text. So, the point is to end up with several

million files, each containing one line of text, in a

folder named Texts. Anyone have an idea how do this?

Thanks,

Dan

;;;;

   run;

art297
Opal | Level 21

DN: Yes, I;m about 2 months late responding to this, but I am playing around with SAS text miner this afternoon, trying to analyze a bunch of emails, and its instructions suggest it is best to start with separate files for each email.  I had created a SAS file containing all of the relevant info, but now am going to try it with separate txt files for each email.  The code you suggested, in response to the OP's request, will be quite helpful.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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