I'm having a very hard time following this thread and understanding what you're trying to do and which parts you need help with, so I'll bow out from here.
If you're looking to split the file into specific sizes, I have a macro that does that here:
/*This macro splits a data set into data sets of size N.
The parameters required are:
1. DSN = input data set name, such as sashelp.cars.
The libname should be included unless the data set
is in the work library.
2. Size = Number of records to be included in each data
set. Note that the last data set will be truncated,
ie if only 28 records are available only 28 will be
written to the output data set.
3. outDsnPrefix = Name of output data sets, will be indexed as
outDSNPrefix1
outDSNPrefix2
outDSNPrefix3
*/
%macro split (dsn=, size=, outDsnPrefix=Split);
%*Get number of records and calculate the number of files needed;
data _null_;
set &dsn. nobs=_nobs;
call symputx('nrecs', _nobs);
n_files=ceil(_nobs/ &size.);
call symputx('nfiles', n_files);
stop;
run;
%*Set the start and end of data set to get first data set;
%let first=1;
%let last=&size.;
%*Loop to split files;
%do i=1 %to &nfiles;
%*Split file by number of records;
data &outDsnPrefix.&i.;
set &dsn. (firstobs=&first obs=&last);
run;
%*Increment counters to have correct first/last;
%let first = %eval(&last+1);
%let last = %eval((&i. + 1)*&size.);
%end;
%mend split;
*Example call;
*After running this, you should find 9 data sets named Split1-Split9;
%split(dsn=sashelp.cars, size=50, outDsnPrefix=Split);
https://gist.github.com/statgeek/abc3c6ce1dbeedb84fe7f11da0603cda
@FADUVIGA wrote:
Like this: (imagine that it is a tabe)
TYPE DATE CIA XXXX VALUE 1 29/07/2019 BR350 RESULT 500,00 2 RESULT - 650,78 2 RESULT 400,50 2 RESULT 700,50 2 (-RESULT) - 500,00 2 (-RESULT) 650,78 2 (-RESULT) - 400,50 2 (-RESULT) - 700,50 1 29/07/2019 BR700 RESULT 650,00 2 RESULT 700,00 2 RESULT 3.555,00 2 RESULT 90,00 2 (-RESULT) - 650,00 2 (-RESULT) - 700,00 2 (-RESULT) - 3.555,00 2 (-RESULT) - 90,00
... View more