BookmarkSubscribeRSS Feed
AVUH777
Obsidian | Level 7

Hey! 

So, I'm working with what I believe to be the most recent version of the Prep Guide for the Base exam and using SAS Enterprise Guide. I downloaded the zip file to create the data from the link provided in the book and followed the directions to set up the data. When I try to create the datasets using the cre8data file, although it appears to be actually creating all of the sas datasets, excel files, etc, I'm still getting an error when I run the program. I would ignore it, but I don't know if it'll be an issue later. 

 

Heres the code:

%let path=O:\Test\SAS Exam\base-guide-practice-data\cert;
/********************************************************************
 Do not modify the code below this line 
********************************************************************/
%macro setdelim;
   %global delim;
   %if %index(&path,%str(/)) %then %let delim=%str(/);
   %else %let delim=%str(\);
%mend;
%setdelim

%macro makedata;
%include "&path&delim.cre8permdata.sas";
%include "&path&delim.cre8workdata.sas";
%include "&path&delim.cre8flatfiles.sas";
%put;
%put NOTE- *******************************************************;
%put NOTE- Your SAS Certification Prep Guide data files are ready.;
%put NOTE- *******************************************************;
%mend;
%makedata;

Here are the errors I'm seeing:

ERROR: Macro function %INDEX has too many arguments.
ERROR: %EVAL function has no expression to evaluate, or %IF statement has no condition.
ERROR: The macro SETDELIM will stop executing.

 

I'm trying to avoid editing the code and am assuming it's an issue on my end... any ideas? 

 

2 REPLIES 2
ballardw
Super User

First thing, when asking about Errors or anything that appears in the log such as warning or other diagnostic message include the Code submitted along with the error message. Sometimes what people actually submit is not what they show in their editor.

In this case your code should include everything from the %let Path =.

Second, copy the text from the log and then on the forum open a text box using the </> icon that appears above the message window. Paste all the copied text. The log sometimes includes diagnostic characters but the main main message window on this forum will reformat pasted text so that the diagnostics may not appear in the correct position making them less useful. Also the text box separates the code/log under discussion from the actual discussion.

 

When I ran your code code for example my log looks like:

540  %let path=O:\Test\SAS Exam\base-guide-practice-data\cert;
541  /********************************************************************
542   Do not modify the code below this line
543  ********************************************************************/
544  %macro setdelim;
545     %global delim;
546     %if %index(&path,%str(/)) %then %let delim=%str(/);
547     %else %let delim=%str(\);
548  %mend;
NOTE: The macro SETDELIM completed compilation without errors.
      18 instructions 316 bytes.
549
550  %setdelim

So can't duplicate your error.

The type of thing that is most likely to cause a "too many parameters" is the presence of a comma somewhere.

For instance if there is a comma in the Path variable I can replicate the error:

551  %let path=O:\Test\SAS Exam\base-guide,practice-data\cert;
552  /********************************************************************
553   Do not modify the code below this line
554  ********************************************************************/
555  %macro setdelim;
556     %global delim;
557     %if %index(&path,%str(/)) %then %let delim=%str(/);
558     %else %let delim=%str(\);
559  %mend;
NOTE: The macro SETDELIM completed compilation without errors.
      18 instructions 316 bytes.
560
561  %setdelim
ERROR: Macro function %INDEX has too many arguments.
ERROR: %EVAL function has no expression to evaluate, or %IF statement has no condition.
ERROR: The macro SETDELIM will stop executing.

See the comma between "guide" and "practice"?

Which is why I suggested including the Log with the %let path= part.

 

If you copy text from something you may want to try retyping it as some sources will have either non-printable characters that cause problems or will have "fancy" versions of the same character such as "curly" or "smart" quote symbols that are treated differently in programs than the basic ' or " from the keyboard.

 

BTW, while not always a problem causer the more special characters you include in file paths, such as that dash, the more likely you are to get some odd errors. Working with macros % and & especially will cause problems. A dash in some place may well be interpreted as an instruction to subtract.

 

Personally I would be tempted to recreate the folder with underscore characters as underscores are less likely to cause problems in general.

AVUH777
Obsidian | Level 7

Ah, thanks for that! I did end up discovering the issue. The path I used contained a comma. I usually use this path when I'm using SAS so I didn't think it'd be a problem, but I guess with the way the macro reads it, it became one lol. Thanks again!

Welcome to the Certification Community

 

This is a knowledge-sharing community for SAS Certified Professionals and anyone who wants to learn more about becoming SAS Certified. Ask questions and get answers fast. Share with others who are interested in certification and who are studying for certifications.To get the most from your community experience, use these getting-started resources:

Community Do's and Don'ts
How to add SAS syntax to your post
How to get fast, helpful answers

 

Why Get SAS Certified.jpg

SAS Training: Just a Click Away

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

Browse our catalog!

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