Hi @Walternate
If your SAS setup allows accessing the OS command, then you can use this macro on either Windows/Linux
%macro util_getFileLineCount(p_textFile=, p_rtrnMacVarName=, p_funkyString=\n);
%LOCAL l_os l_firstObs;
%let l_os = %substr(&sysscp,1,3);
%let l_firstObs=1;
%if (&l_os EQ LIN) %then
%do;
FILENAME filesize pipe "wc -l &p_textFile";
%end;
%else /*(&l_os EQ WIN)*/
%do;
FILENAME filesize pipe "find /V /C ""&p_funkyString"" &p_textFile";
%let l_firstObs=2;
%end;
DATA _NULL_;
INFILE filesize FIRSTOBS=&l_firstObs END=eof;
INPUT;
%if (&l_os EQ LIN) %then
%do;
CALL SYMPUTX("&p_rtrnMacVarName",SCAN(_INFILE_,1,' '));
%end;
%else
%do;
CALL SYMPUTX("&p_rtrnMacVarName",SCAN(_INFILE_,-1,':'));
%end;
RUN;
%mend util_getFileLineCount;
%global g_lineCount;
%util_getFileLineCount(p_textFile=%str(<path/filename.type>), p_rtrnMacVarName=g_lineCount, p_funkyString=\n);/* Change \n to a different value that shouldn't be in the file */
%put &=g_lineCount;
Note: You can save the util_getFileLineCount macro into it's own file util_getfilelinecount.sas for re-use.
Hope this helps
... View more