Just to be clearer: The macro does use filename ... temp ... in
%if %sysevalf(&sysver > 6.10) %then %do;
filename &fileref temp &options
%if %length(&ls)>0 %then lrecl=&ls;
;
%end;
A typical use for this is in my table macro, http://www.datavis.ca/sasmac/table.html where I convert numeric variables to their formatted character strings by printing them to a temporary file and then reading the result back in. (Maybe there is now
an easier way to do this??). The code for this is:
%if %length(&char)>0 %then %do;
/*
* Force the VAR= variables to character. To do this cleanly, we
* resort to printing the &out dataset, then reading it back as
* character.
* In SAS 9.3, this only works if ODS LISTING is turned on.
*/
%tempfile(table,&ls);
%if %sysevalf(&sysver >9.2) %then %do;
ods listing;
%end;
proc printto new print=table;
options nodate nocenter nonumber ls=&ls ps=10000;
proc print data=&out;
id &var;
var count;
run;
%if &syserr > 4 %then %let abort=1; %if &abort %then %goto DONE;
proc printto print=print;
%let tvar = %join(&var, $) $;
%*put tvar=&tvar;
%if %verify(&char, %str(0123456789))=0
%then %let clen=&char;
%else %let clen=16;
data &out;
infile table length=len;
length string $&ls &var $&clen;
retain skipping 1;
drop string skipping;
input @1 string $varying. len @;
if skipping=0 & string ^= ' ' then do;
input @1 &tvar count;
output;
end;
else input;
if index(string,'COUNT')>0 then skipping=0;
run;
*proc contents data=&out;
%tempdel(table);
%if %sysevalf(&sysver >9.2) %then %do;
ods listing close;
%end;
... View more