Note:
Don't place URL's like that with &'s in them inside of double quotes. The SAS macro processor will try to convert anything that looks like a macro variable reference, like &term into the value of the macro variable. Use single quotes instead and the macro processor will ignore the &'s and %'s in the string.
If you need to build the URL from pieces then do so in a data step. You could then use the FILENAME() function to generate your fileref.
data _null_;
url='https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=PNAS[ta]+AND+97[vi]&retstart=6&retmax=6&tool=biomed3';
rc=filename('Y',url,'url');
run;
... View more