Hi again The dataset is about 2.5 million records. Combining some of the variables creates a link that can be used in a web browser to download different information from our system. I will hereafter use a VBA script in Excel to download the files. After controlling the filename in raw data and the filename in the web browser, its not always the same, some characters changes and that's the reason for my code. Every single record for the filename variable is different. Values in the filename variable could be some thing like this: EmailImport-VS {{POST}}Advisering pr. 30.12.2013 [Ref.nr.].pdf {{SERVICE}} Postkasse [Autotitel=2018A12A1327] [Ref.nr.=49e392c5d6-df75-4687-ba81-effd3a4a752a.pdf In the webbrowser values for }, {, [, ], = and etc. has its own values and that's the reason for my coding. I thought maybe there was a better way than creating 40 variables where I each time changes something different. In the end I only need the last variable where all preceding things have been changed. Maybe nested regular expressions? or something else ? Data test_2;
set test_1;
/*characters that's the same in raw data and in the web browser - identifying records that's different*/
special_char=compress(Filnavn_WF,'abcdefghijklmnopqrstuvwxyz0123456789.()!-','U');
if not missing(special_char) then do;
Filename_WF1=left(prxchange('s/[¤]/%c2%a4/oi',-1,trim(Filename_WF)));
Filename_WF2=left(prxchange('s/[@]/%40/oi',-1,trim(Filename_WF1)));
Filename_WF3=left(prxchange('s/['']/%27/oi',-1,trim(Filename_WF2)));
Filename_WF4=left(prxchange('s/[;]/%3b/oi',-1,trim(Filename_WF3)));
Filename_WF5=left(prxchange('s/[`]/%60/oi',-1,trim(Filename_WF4)));
Filename_WF6=left(prxchange('s/[´]/%c2%b4/oi',-1,trim(Filename_WF5)));
Filename_WF7=left(prxchange('s/[¨]/%c2%a8/oi',-1,trim(Filename_WF6)));
Filename_WF8=left(prxchange('s/[§]/%c2%a7/oi',-1,trim(Filename_WF7)));
/*.... etc. */
end;
run;
... View more