Do you need to identify which specific agreement number is in the file or just that an agreement is found?
If just that an agreement in the list is found, then SQL is a better option. If you need to find the specific agreement, then a data step approach with a a temporary array is a better approach.
https://gist.github.com/statgeek/2f733d27820f43fa37d6ba92c30f22cf
@alepage wrote:
Imagine that I have many datasets like
dataset1
dataset2
.
.
.
dataset1000
Then I have an agreement_nbr like PPPPP0447187
Now I have created a macro function to seach this value in many dataset, except that I am sendig the agreement_nbr, the path and filename into the log file.
How can we send this information into Data want, for example.
Imagine that I have many agreement_nbr to search for and some basic information surch as path, agreement_nbr and filename into data want. How do we do that.?
%let monthlist=aou avr dec fev jan jul jun mai mar nov oct sep;
%let yearlist=2006 2007 2008 2009 2010;
%let subfolder=auto habi entr;
%let loblist=auto prop cna;
%let cielist=nx;
%macro test;
Data temp;
length filename $25. libname $100. policyfound $20.;
run;
%do h=1 %to %sysfunc(countw(&cielist.));
%do i=1 %to %sysfunc(countw(&loblist.))-1;
%do k=1 %to %sysfunc(countw(&yearlist.));
%do j=1 %to %sysfunc(countw(&monthlist.));
%let fname=%scan(&cielist.,&h)_%scan(&loblist.,&i)_prm%scan(&monthlist.,&j)%scan(&yearlist.,&k);
%let libnm=/dwh_actuariat/sasdata/sas%scan(&yearlist.,&k)/%scan(&cielist.,&h)/%scan(&subfolder.,&i)/;
%put &=libnm &=fname.;
libname src1 spde "&libnm.";
data _null_;
set src1.&fname;
%let agreement_nbr=PPPPP0447187;
if agreement_nbr eq "&agreement_nbr." then
do;
put "the policy &agreement_nbr exist in &libnm/&fname.";
end;
run;
%end;
%end;
%end;
%end;
%mend test;
%test;
... View more