SASUnit Examples  Version 1.5.0
_getpgmdesc.sas
Go to the documentation of this file.
1 
23 %MACRO _getPgmDesc (i_pgmfile =
24  ,r_desc = desc
25  );
26 
27 %LET &r_desc=;
28 %IF NOT %sysfunc(fileexist(&i_pgmfile)) %THEN %RETURN;
29 
30  data _null_;
31  infile "&i_pgmfile" truncover end=eof;
32  length desc $255;
33  retain inbrief 0 desc;
34  input line $255.;
35  if upcase(line) =: '\BRIEF' then do;
36  line = left (substr(line,7));
37  inbrief=1;
38  end;
39  if substr(line,1,1)='\' or line=' ' or line='0D'x then inbrief=0;
40  if inbrief then do;
41  if desc=' ' then desc = line;
42  else desc = trim(desc) !! ' ' !! line;
43  end;
44  if eof then do;
45  if desc = ' ' then desc ="&i_pgmfile.";
46  call symput("&r_desc", trimn(desc));
47  end;
48  run;
49 
50 %MEND _getPgmDesc;