Already big thanks for your replies.
I know I can stop after 2 records, but now for testing i changed it to the last row.
Indeed, SASHELP tables in combination with SAP is impossible. Also, i don't want to create formats of every SAP table. Only those I want.
My code:
%macro Test(source); data _null_; set SAP_SRC."&source"n end=lastobs; if _n_ = 1 then call symputx('obscnt',0); if lastobs then Call symputx('obscnt', _N_); run; %put &source=&obscnt; %if &obscnt > 0 %then %do; %end; %mend;
data _null_; set all_columns; call execute('%Test(source='||strip(dataset)||')'); run;
This is the output in my log: as you can see... it's always 50, but is because my last table has 50 records.. all the rest have more
For example: NOTE: There were 1292 observations read from the data set SAP_SRC.'/BIC/TZMAGBEST'n.
So.. something is not working correctly with the macro variable i think?
/BIC/TVAUFNR=50 /BIC/TZBEHVRSC=50 /BIC/TZBELEVFEQ=50 /BIC/TZFINTYPE=50 /BIC/TZMAGBEST=50 /BIC/TZMATPLANT=50 /BIC/TZMATPROF=50 /BIC/TZMKPFUSN=50 /BIC/TZMSATTYP=50 /BIC/TZMSBUKRS=50 /BIC/TZMSBUWD=50 /BIC/TZMSBWART=50 /BIC/TZMSBWKEY=50 /BIC/TZMSBWTAR=50 /BIC/TZMSDEFSH=50 2 The SAS System 12:49 Thursday, October 19, 2017
/BIC/TZMSGRUNDS=50 /BIC/TZMSGSBER=50 /BIC/TZMSKOKRS=50 /BIC/TZMSKOSTL=50 /BIC/TZMSKSTRG=50 /BIC/TZMSKUNNR=50 /BIC/TZMSKZEAR=50 /BIC/TZMSLGORT=50 /BIC/TZMSLIFNR=50 /BIC/TZMSMATNR=50 /BIC/TZMSPRCTR=50 /BIC/TZMSRWEMPF=50 /BIC/TZMSSAKTO=50 /BIC/TZMSSHKZG=50 /BIC/TZMSUMWRK=50 /BIC/TZMSWERKS=50 /BIC/TZMSZBWAR=50 /BIC/TZONWW=50 /BIC/TZSTPLOPHP=50 /BIC/TZUIDMATPO=50 /BIC/TZVSTBEST=50
... View more