BookmarkSubscribeRSS Feed
SASHunter
Obsidian | Level 7
I have the following macro that I was looking at, but need more explanations of what one part is made up of :

/* Loops through the directory */
%do i = 1 %to &memcnt;

%let fname=%qscan(%qsysfunc(dread(&did,&i)),1,.);
%let testname=%substr(&fname,1,4);

%if &testname = capi or &testname = cati %then %do;

* delete the file;
proc datasets library=lhost;
delete &fname.;
run;
quit;
%end;
%end;


The one I need more info on is the %qscan statement. I don't know what the number one is for or the (.).

Thanks,
Nancy
2 REPLIES 2
Cynthia_sas
Diamond | Level 26
Hi:
From the doc:
http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#/documentation/cd...

%QSCAN(argument, n<,charlist <,modifiers>>)

by that documentation, then your %QSCAN breaks down as:

%QSCAN(
argument is %qsysfunc(dread(&did,&i))
n is 1
charlist is .
there are no modifiers to the %QSCAN

You can look up what N is in the documentation for %QSCAN. Basically, &FNAME will be set to the first chunk of whatever is returned by %QSYSFUNC invocation of the DREAD function delimited by the . (or period).

cynthia
SASHunter
Obsidian | Level 7
Thanks for explaining that.
It helped.

Nancy

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand in the Innovate Hub.

Watch Now →
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1772 views
  • 0 likes
  • 2 in conversation