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.
... View more