Help using Base SAS procedures

Can someone tell me what this all means?

Reply
Frequent Contributor
Posts: 80

Can someone tell me what this all means?

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
SAS Super FREQ
Posts: 8,743

Re: Can someone tell me what this all means?

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
Frequent Contributor
Posts: 80

Re: Can someone tell me what this all means?

Thanks for explaining that.
It helped.

Nancy
Ask a Question
Discussion stats
  • 2 replies
  • 108 views
  • 0 likes
  • 2 in conversation