Hi, I have a text(.txt) file that has millions of rows approx. 3 mil. I want to convert it into small SAS datasets (around 4)

31 Views Asked by At

So i want to break down the txt file into multiple smaller sas datasets, can someone tell me how to do it, i searched a lot but nothings working.

I am doing it on sas studio

thanks!

I tried using macros, but the problem is i am unable to get my original variable names, and i am loosing data too

1

There are 1 best solutions below

0
Joe On

If you're using a data step to read this in, you can do this fairly easily.

data want1 want2 want3 want4;
  infile yourfile;
  input [stuff];
  if _n_ lt 1000000 then output want1;
  else if _n_ lt 2000000 then output want2;
  else if _n_ lt 3000000 then output want3;
  else output want4;
run;

Fairly straightforward.