BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Srigyan
Quartz | Level 8

I was trying to delete an index from a table if that exist and if it does not exist then create one. This is the final objective. I found a macro on this community 

%let final_file=testfile;

%macro flg_exist(final_File);
%let dsid=%sysfunc(open(&final_File.));
%let ndx_flag=%sysfunc(attrn(&dsid,isindex));
%put Index exists flag= &ndx_flag;

%let rc=%sysfunc(close( &dsid ));
%put Dataset closed return code= &rc;

%if &ndx_flag=1 %then %let ndx_delete=index delete zip5 %str(Smiley Wink;
%else %if &ndx_flag=0 %then %let ndx_delete=;
%put Index delete statement =&ndx_delete;
%mend;

%flg_exist(&final_File.);

 

 

however I am getting following error:

 

ODS _ALL_ CLOSE;
9          OPTIONS DEV=ACTIVEX;
NOTE: The quoted string currently being processed has become more than 262 bytes long.  You might have unbalanced quotation marks.
1          ;*';*";*/;quit;run;
                ______________
                49
NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release.  Inserting white space 
             between a quoted string and the succeeding identifier is recommended.

10         GOPTIONS XPIXELS=0 YPIXELS=0;
11         FILENAME EGSR TEMP;
12         ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR
13             STYLE=FestivalPrinter
14             STYLESHEET=(URL="file:///C:/Program%20Files/SASHome2/SASEnterpriseGuide/7.1/Styles/FestivalPrinter.css")
14             STYLESHEET=(URL="file:///C:/Program%20Files/SASHome2/SASEnterpriseGuide/7.1/Styles/FestivalPrinter.css"

___________________________________________________________________________________________    

My only purpose is to delete the index if it is there, then create an index. So other solution will also work.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Amir
PROC Star

Perhaps it is just my browser, but I can see the following in your code:

 

%str(Smiley Wink;

which I guess is caused by an attempt to supply a semicolon in the %str() function.

If that is also in your SAS code then you could try:

 

%str( ; );

 

Regards,

Amir.

View solution in original post

7 REPLIES 7
ChrisBrooks
Ammonite | Level 13

This is most likely not caused by the code you have listed but is caused somewhere else in your program - you have an opening quotation mark somewhere without a corresponding closing one, the SAS compiler then becomes confused thinking your next opening quote is the closing quote of the previous one and so on.

Srigyan
Quartz | Level 8

This is the only code used for this purpose.So if there is an error that is in available in my shown code only. Let me know where do you see this error. Finalfile macro is just a dateset name.

Amir
PROC Star

Perhaps it is just my browser, but I can see the following in your code:

 

%str(Smiley Wink;

which I guess is caused by an attempt to supply a semicolon in the %str() function.

If that is also in your SAS code then you could try:

 

%str( ; );

 

Regards,

Amir.

Srigyan
Quartz | Level 8

I am stupid. Thanks 🙂

Amir
PROC Star

We're all learning. Using:

 

options mlogic symbolgen;

before you invoked the macro might have assisted by displaying extra information in the log.

 

Regards,

Amir.

Kurt_Bremser
Super User

The macro code has been damaged because somebody did not use the proper subwindow ("little running man" or {i} button) for posting code.

This is the culprit:

%str(Smiley Wink;

The missing closing bracket causes everything after it to be considered part of the macro function parameter, which in the end leads to this message:

NOTE: The quoted string currently being processed has become more than 262 bytes long.  You might have unbalanced quotation marks.

 

That's why we always keep pestering people to post code correctly (NOT in the main posting window).

Srigyan
Quartz | Level 8

Thanks

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 7 replies
  • 969 views
  • 1 like
  • 4 in conversation