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
SAS Super FREQ
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

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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