I am trying to red the dataset in SAS and write it to a file as HTML content ,to open it in xls format. When i try to execute the code at line "put "<TD class="xl13cAlign" x:num='&v7'>&v7</TD>";" it giving error stating " Statement is not valid or used out of proper order." if i remove the macro call or remove the proc sql which i do to read the data from dataset it is working fine. any idea what is the issue?. Pease suggest. %macro getOrders(dataSetName,x,Y,I); proc sql; create table return as ( select orders from &dataSetName where bi =%unquote(%str((%'&B%'))) and iss_yr=%unquote(%str((%'&Y%'))) and iss_no=%unquote(%str((%'&I%'))) ); run; quit; %let id1=%sysfunc(open(return)); %let NObs1=%sysfunc(attrn(&id1,NOBS)); %syscall set(id1); %do i1=1 %to &NObs1; %let rc1=%sysfunc(fetchobs(&id1,&i1)); %let v7 = %NRBQUOTE(&orders); put "<TD class="xl13cAlign" x:num='&v7'>&v7</TD>"; %end; %mend getOrders; %macro excelPrintValues(dataSetName); data _null_; file "d:\twr\work\rpt207_report_&id._1.xls"; put '<html xmlns:o="urn:schemas-microsoft-com:office:office"'; put 'xmlns:x="urn:schemas-microsoft-com:office:excel"'; put 'xmlns="http://www.w3.org/TR/REC-html40">'; put '<head>'; %let id=%sysfunc(open(&dataSetName)); %let NObs=%sysfunc(attrn(&id,NOBS)); %syscall set(id); %do i=1 %to &NObs; %let rc=%sysfunc(fetchobs(&id,&i)); %let v1 = %NRBQUOTE(&B); %let v2 = %NRBQUOTE(&T); %let v3= %NRBQUOTE(&F); %let v13 = %NRBQUOTE(&Y); %let v4= %NRBQUOTE(&I); %let v5 = %NRBQUOTE(&o); %let v6 = %NRBQUOTE(&o); put "<tr>"; put "<TD class="xl13cAlign" x:num='&v1'>&v1</TD>"; put "<TD class="xl13cAlign" >&v2</TD>"; put "<TD class="xl13cAlign" >&v3</TD>"; put "<TD class="xl13cAlign" x:num='&v13'>&v13</TD>"; put "<TD class="xl13cAlign" x:num='&v4'>&v4</TD>"; put "<TD class="xl13cAlign" x:num='&v5'>&v5</TD>"; put "<TD class="xl13cAlign" x:num='&v6'>&v6</TD>"; getOrders(order_details,&B,&Y,&I); put "</tr>"; %end; %let id=sysfunc(close(&id)); %mend excelPrintValues;
... View more