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
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;
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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.