SASUnit Examples  Version 1.2.1
_sasunit_stdpath.sas
Go to the documentation of this file.
1 
20 %MACRO _sasunit_stdPath(
21  i_root
22  ,i_path
23 );
24 %LET i_root = %sysfunc(translate(&i_root,/,\));
25 %IF "%substr(&i_root,%length(&i_root),1)" NE "/"
26  %THEN %LET i_root = &i_root/;
27 %LET i_path = %sysfunc(translate(&i_path,/,\));
28 %IF "%substr(&i_path,%length(&i_path),1)" EQ "/"
29  %THEN %LET i_path = %substr(&i_path,1,%eval(%length(&i_path)-1));
30 
31 %IF %index(%upcase(&i_path)/, %upcase(&i_root)) %THEN %DO;
32  %IF %length (&i_path) > %length(&i_root) %THEN %DO;
33  %substr(&i_path,%eval(%length(&i_root)+1))
34  %END;
35 %END;
36 %ELSE %DO;
37  &i_path
38 %END;
39 %MEND _sasunit_stdPath;
41 /*
42 %put %_sasunit_stdPath(c:\temp,c:\temp\test\sas.log);
43 %put %_sasunit_stdPath(c:\temp,c:\temp\test\);
44 %put %_sasunit_stdPath(c:\temp,c:\temp\test);
45 %put %_sasunit_stdPath(c:\temp,c:\temp\);
46 %put %_sasunit_stdPath(c:\temp,c:\temp);
47 %put %_sasunit_stdPath(c:\temp,c:\tempo);
48 %put %_sasunit_stdPath(c:\temp,d:\temp);
49 */