How do I fix my %QSCAN error

Reply
New Contributor
Posts: 3

How do I fix my %QSCAN error

I keep gettingthe message- ERROR: Macro function %QSCAN has too many arguments. OI can't figure out how to get my program to scan through the list of datasheets and continue until each comma. Any help would be appreciated!

 

%MACRO DASHBOARD;

%LET DATASHEETS = Roster for All Schools - Rows, Behavior Internevt - Summaries,
SE interventi(2) - Summaries, Attendance Interve - Summaries, DA & TA Attenda(2) - Summaries,
SA Attenda(2) - Summaries, Behav(2) - Summaries;
%LET NEW = Roster BH_int SE_int AT_int AT_DA_TA AT_SA BH_DS;

%DO I = 1 %TO 7;
%LET DATASHEET = %QSCAN (&DATASHEETS.,&I,',','OQ');
%LET Y = %SCAN (&NEW.,&I,' ');

PROC IMPORT OUT= &Y DATAFILE= "U:\Data Team\2 Dashboards\1 Weekly\FY 17\Data\SDR_090416_091016_09.22.16.xlsx"
DBMS=xlsx REPLACE;
SHEET= '&DATASHEET';
%END;
PROC CONTENTS;

%MEND DASHBOARD;
%DASHBOARD;

Super User
Posts: 11,134

Re: How do I fix my %QSCAN error

Your DATASHEETS variable contains commas. So when QSCAN looks at the macro variable then the first comma is treated as a delimiter to the function.

 

Use %quote as one way to fix:

 

%LET DATASHEETS = %quote(Roster for All Schools - Rows, Behavior Internevt - Summaries,

SE interventi(2) - Summaries, Attendance Interve - Summaries, DA & TA Attenda(2) - Summaries,

SA Attenda(2) - Summaries, Behav(2) - Summaries);

 

Super User
Posts: 9,867

Re: How do I fix my %QSCAN error

Maybe this:

%LET DATASHEET = %QSCAN (&DATASHEETS.,&I, %str(,)  ,  OQ );


Ask a Question
Discussion stats
  • 2 replies
  • 266 views
  • 0 likes
  • 3 in conversation