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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register 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.

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
  • 614 views
  • 0 likes
  • 2 in conversation