<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: DDE Error in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/DDE-Error/m-p/32980#M4841</link>
    <description>You do not need to post the same question in 2 separate forums, especially since you do NOT use ODS when you are using DDE.&lt;BR /&gt;
&lt;BR /&gt;
A  suggestion has been posted at your other posting site:&lt;BR /&gt;
&lt;A href="http://support.sas.com/forums/thread.jspa?messageID=52398첮" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?messageID=52398첮&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
    <pubDate>Fri, 18 Mar 2011 14:11:28 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2011-03-18T14:11:28Z</dc:date>
    <item>
      <title>DDE Error</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/DDE-Error/m-p/32978#M4839</link>
      <description>Hi ,&lt;BR /&gt;
&lt;BR /&gt;
I am getting an error while exporting an data using DDE. The steps taken to resolve this issue:&lt;BR /&gt;
1. Opened an new sas session&lt;BR /&gt;
2. Closed the excel sheet and ran the program.&lt;BR /&gt;
3. Opened the excel sheet &amp;amp; minimized and ran the program&lt;BR /&gt;
&lt;BR /&gt;
But still am getting an error as below,&lt;BR /&gt;
ERROR: DDE session not ready.&lt;BR /&gt;
FATAL: Unrecoverable I/O error detected in the execution of the data step program.Aborted during the EXECUTION phase.&lt;BR /&gt;
&lt;BR /&gt;
Please let me know how to resolve this issue.&lt;BR /&gt;
&lt;BR /&gt;
Thanks in Advance</description>
      <pubDate>Fri, 18 Mar 2011 14:00:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/DDE-Error/m-p/32978#M4839</guid>
      <dc:creator>raveena</dc:creator>
      <dc:date>2011-03-18T14:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: DDE Error</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/DDE-Error/m-p/32979#M4840</link>
      <description>In order to obtain a  help, you need to show your entire code and log&lt;BR /&gt;
&lt;BR /&gt;
Andre</description>
      <pubDate>Fri, 18 Mar 2011 14:05:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/DDE-Error/m-p/32979#M4840</guid>
      <dc:creator>Andre</dc:creator>
      <dc:date>2011-03-18T14:05:51Z</dc:date>
    </item>
    <item>
      <title>Re: DDE Error</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/DDE-Error/m-p/32980#M4841</link>
      <description>You do not need to post the same question in 2 separate forums, especially since you do NOT use ODS when you are using DDE.&lt;BR /&gt;
&lt;BR /&gt;
A  suggestion has been posted at your other posting site:&lt;BR /&gt;
&lt;A href="http://support.sas.com/forums/thread.jspa?messageID=52398첮" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?messageID=52398첮&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 18 Mar 2011 14:11:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/DDE-Error/m-p/32980#M4841</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2011-03-18T14:11:28Z</dc:date>
    </item>
    <item>
      <title>Re: DDE Error</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/DDE-Error/m-p/32981#M4842</link>
      <description>Hi Andre,&lt;BR /&gt;
&lt;BR /&gt;
Here is the code&lt;BR /&gt;
&lt;BR /&gt;
%macro dde_openExcel;&lt;BR /&gt;
options noxsync noxwait;&lt;BR /&gt;
filename sas2xl dde 'excel|system'; * reference toopen/closeexcel;&lt;BR /&gt;
data _null_;&lt;BR /&gt;
length fid rc start stop time 8;fid=fopen('sas2xl','s');&lt;BR /&gt;
if (fid le 0) then do;rc=system('start excel');&lt;BR /&gt;
start=datetime();stop=start+10;&lt;BR /&gt;
do while (fid le 0);fid=fopen('sas2xl','s');&lt;BR /&gt;
time=datetime();if (time ge stop) then fid=1;end;end;&lt;BR /&gt;
rc=fclose(fid);run;&lt;BR /&gt;
%mend dde_openExcel;&lt;BR /&gt;
&lt;BR /&gt;
%macro dde_makeWorkbook(thepath=,thefile=);&lt;BR /&gt;
filename sas2xl dde 'excel|system';&lt;BR /&gt;
filename DDEcmds dde 'excel|system'; &lt;BR /&gt;
data _null_;&lt;BR /&gt;
file sas2xl;put '[error(false)]';&lt;BR /&gt;
put %unquote(%bquote('[save.as("&amp;amp;thepath.\&amp;amp;thefile")]')); * save as ;run;&lt;BR /&gt;
%mend dde_makeWorkbook;&lt;BR /&gt;
&lt;BR /&gt;
%macro dde_delvars;&lt;BR /&gt;
 data vars; set sashelp.vmacro; run;&lt;BR /&gt;
  data _null_;set vars;&lt;BR /&gt;
    if scope='GLOBAL' and substr(name,1,9)='VARHEADER' then&lt;BR /&gt;
      call execute('%symdel '||trim(left(name))||';'); run;&lt;BR /&gt;
  data _null_;set vars;&lt;BR /&gt;
    if scope='GLOBAL' and substr(name,1,9)='VARLIST' then&lt;BR /&gt;
      call execute('%symdel '||trim(left(name))||';');run;&lt;BR /&gt;
%mend dde_delvars;&lt;BR /&gt;
&lt;BR /&gt;
%macro dde_getRowsColsLabels(dsn=);%global nvar nobs ngroups;&lt;BR /&gt;
proc contents data=&amp;amp;dsn noprint out=&amp;amp;dsn._con; run;&lt;BR /&gt;
proc sql noprint;&lt;BR /&gt;
select max(varnum), max(nobs) into : nvar, : nobs from &amp;amp;dsn._con;quit;&lt;BR /&gt;
	%let nvar = %left(&amp;amp;nvar);&lt;BR /&gt;
	%let nobs = %left(&amp;amp;nobs);&lt;BR /&gt;
	%let vargroup  = %eval(&amp;amp;nvar / 10);&lt;BR /&gt;
	%let vargroups = %eval(&amp;amp;vargroup + 1);&lt;BR /&gt;
	%let ngroups   = %left(&amp;amp;vargroups); &lt;BR /&gt;
	%do i = 1 %to &amp;amp;ngroups; &lt;BR /&gt;
		%let nvarmax = %eval(&amp;amp;i * 10);&lt;BR /&gt;
		%let nvarmin = %eval(&amp;amp;nvarmax - 10 + 1);&lt;BR /&gt;
 		%global varheader&amp;amp;i varlist&amp;amp;i;&lt;BR /&gt;
&lt;BR /&gt;
proc sql noprint;&lt;BR /&gt;
select labelinto :varheader&amp;amp;i separated by '09'xfrom &amp;amp;dsn._con&lt;BR /&gt;
where &amp;amp;nvarmin &amp;lt;= varnum &amp;lt;= &amp;amp;nvarmax order by varnum; quit;&lt;BR /&gt;
proc sql noprint;&lt;BR /&gt;
select name into :varlist&amp;amp;i separated by " '09'x "from &amp;amp;dsn._con&lt;BR /&gt;
where &amp;amp;nvarmin &amp;lt;= varnum &amp;lt;= &amp;amp;nvarmax order by varnum; quit; %end;&lt;BR /&gt;
%mend dde_getRowsColsLabels;&lt;BR /&gt;
&lt;BR /&gt;
* Write header and data records from SAS to Excel ;&lt;BR /&gt;
%macro dde_writeToX(workbook=,worksheet=,dsn=);&lt;BR /&gt;
	%do i = 1 %to &amp;amp;ngroups;&lt;BR /&gt;
	%let nvarmax = %eval(&amp;amp;i * 10);&lt;BR /&gt;
		%let nvarmin = %eval(&amp;amp;nvarmax - 10 + 1);filename ddedata dde "excel|[&amp;amp;workbook.]&amp;amp;worksheet.!r1c&amp;amp;nvarmin.:r1c&amp;amp;nvarmax" notab;&lt;BR /&gt;
		data _null_;file ddedata; put "&amp;amp;&amp;amp;varheader&amp;amp;i";run;&lt;BR /&gt;
%let nobsplus1 = %eval(&amp;amp;nobs + 1);&lt;BR /&gt;
filename ddedata dde "excel|[&amp;amp;workbook.]&amp;amp;worksheet.!r2c&amp;amp;nvarmin.:r&amp;amp;nobsplus1.c&amp;amp;nvarmax" notab;&lt;BR /&gt;
data _null_;file ddedata;set &amp;amp;dsn;put &amp;amp;&amp;amp;varlist&amp;amp;i;run;&lt;BR /&gt;
	%end;&lt;BR /&gt;
%mend dde_writeToX;&lt;BR /&gt;
&lt;BR /&gt;
%macro dde_closeSave(thepath=,thefile=);&lt;BR /&gt;
	data _null_;file sas2xl;&lt;BR /&gt;
	  put '[error(false)]';&lt;BR /&gt;
put %unquote(%bquote('[save.as("&amp;amp;thepath.\&amp;amp;thefile")]')); * save as ;put '[file.close("true")]'; * close the file [true=save / false=do not save] ;&lt;BR /&gt;
put '[quit()]';run;&lt;BR /&gt;
%mend dde_closeSave;options noxwait noxsync; &lt;BR /&gt;
&lt;BR /&gt;
* dde processing;&lt;BR /&gt;
%macro dde_process(st=, dsn=, file=);&lt;BR /&gt;
	%let path = &amp;amp;drv7.\&amp;amp;st.\&amp;amp;project.\current; &lt;BR /&gt;
	%dde_openExcel;data test; x=sleep(3);run;&lt;BR /&gt;
	%dde_makeWorkbook(thepath=&amp;amp;path, thefile=&amp;amp;file)	;&lt;BR /&gt;
	%dde_delvars;&lt;BR /&gt;
	%dde_getRowsColsLabels(dsn=&amp;amp;dsn);&lt;BR /&gt;
	%dde_writeToX(workbook=&amp;amp;file,worksheet=Sheet1,dsn=&amp;amp;dsn);&lt;BR /&gt;
	%if "&amp;amp;file" NE "&amp;amp;project._00_E.xls" and "&amp;amp;file" NE "&amp;amp;project._00_F.xls" %then %do;&lt;BR /&gt;
%formatReportDetail(dsn=&amp;amp;dsn, worksheet=Sheet1);%end;&lt;BR /&gt;
%if "&amp;amp;file" EQ "&amp;amp;project._00_E.xls" %then %do;&lt;BR /&gt;
%formatReportVIPSummary(dsn=&amp;amp;dsn, worksheet=Sheet1);%end;&lt;BR /&gt;
%if "&amp;amp;file" EQ "&amp;amp;project._00_F.xls" %then %do;&lt;BR /&gt;
%formatReportRepProductivity(dsn=&amp;amp;dsn, worksheet=Sheet1);%end;&lt;BR /&gt;
%dde_closeSave(thepath=&amp;amp;path, thefile=&amp;amp;file);&lt;BR /&gt;
%mend dde_process;&lt;BR /&gt;
/*Report E*/&lt;BR /&gt;
%dde_process(st=NY, dsn=VIPsumNY,file=&amp;amp;project._00_E.xls)&lt;BR /&gt;
/*Report F*/&lt;BR /&gt;
%dde_process(st=NY, dsn=mhs2, file=&amp;amp;project._00_F.xls)&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Raveena&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: raveena&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: raveena&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: raveena

Message was edited by: raveena</description>
      <pubDate>Fri, 18 Mar 2011 14:22:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/DDE-Error/m-p/32981#M4842</guid>
      <dc:creator>raveena</dc:creator>
      <dc:date>2011-03-18T14:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: DDE Error</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/DDE-Error/m-p/32982#M4843</link>
      <description>Code continues:&lt;BR /&gt;
&lt;BR /&gt;
proc sql noprint;&lt;BR /&gt;
select labelinto :varheader&amp;amp;i separated by '09'xfrom &amp;amp;dsn._con&lt;BR /&gt;
where &amp;amp;nvarmin &amp;lt;= varnum &amp;lt;= &amp;amp;nvarmax order by varnum; quit;&lt;BR /&gt;
proc sql noprint;&lt;BR /&gt;
select name into :varlist&amp;amp;i separated by " '09'x "from &amp;amp;dsn._con&lt;BR /&gt;
where &amp;amp;nvarmin &amp;lt;= varnum &amp;lt;= &amp;amp;nvarmax order by varnum; quit; %end;&lt;BR /&gt;
%mend dde_getRowsColsLabels;&lt;BR /&gt;
&lt;BR /&gt;
* Write header and data records from SAS to Excel ;&lt;BR /&gt;
%macro dde_writeToX(workbook=,worksheet=,dsn=);&lt;BR /&gt;
	%do i = 1 %to &amp;amp;ngroups;&lt;BR /&gt;
	%let nvarmax = %eval(&amp;amp;i * 10);&lt;BR /&gt;
		%let nvarmin = %eval(&amp;amp;nvarmax - 10 + 1);filename ddedata dde "excel|[&amp;amp;workbook.]&amp;amp;worksheet.!r1c&amp;amp;nvarmin.:r1c&amp;amp;nvarmax" notab;&lt;BR /&gt;
		data _null_;file ddedata; put "&amp;amp;&amp;amp;varheader&amp;amp;i";run;&lt;BR /&gt;
%let nobsplus1 = %eval(&amp;amp;nobs + 1);&lt;BR /&gt;
filename ddedata dde "excel|[&amp;amp;workbook.]&amp;amp;worksheet.!r2c&amp;amp;nvarmin.:r&amp;amp;nobsplus1.c&amp;amp;nvarmax" notab;&lt;BR /&gt;
data _null_;file ddedata;set &amp;amp;dsn;put &amp;amp;&amp;amp;varlist&amp;amp;i;run;&lt;BR /&gt;
	%end;&lt;BR /&gt;
%mend dde_writeToX;&lt;BR /&gt;
&lt;BR /&gt;
%macro dde_closeSave(thepath=,thefile=);&lt;BR /&gt;
	data _null_;file sas2xl;&lt;BR /&gt;
	  put '[error(false)]';&lt;BR /&gt;
put %unquote(%bquote('[save.as("&amp;amp;thepath.\&amp;amp;thefile")]')); * save as ;put '[file.close("true")]'; * close the file [true=save / false=do not save] ;&lt;BR /&gt;
put '[quit()]';run;&lt;BR /&gt;
%mend dde_closeSave;options noxwait noxsync; &lt;BR /&gt;
&lt;BR /&gt;
* dde processing;&lt;BR /&gt;
%macro dde_process(st=, dsn=, file=);&lt;BR /&gt;
	%let path = &amp;amp;drv7.\&amp;amp;st.\&amp;amp;project.\current; &lt;BR /&gt;
	%dde_openExcel;data test; x=sleep(3);run;&lt;BR /&gt;
	%dde_makeWorkbook(thepath=&amp;amp;path, thefile=&amp;amp;file)	;&lt;BR /&gt;
	%dde_delvars;&lt;BR /&gt;
	%dde_getRowsColsLabels(dsn=&amp;amp;dsn);&lt;BR /&gt;
	%dde_writeToX(workbook=&amp;amp;file,worksheet=Sheet1,dsn=&amp;amp;dsn);&lt;BR /&gt;
	%if "&amp;amp;file" NE "&amp;amp;project._00_E.xls" and "&amp;amp;file" NE "&amp;amp;project._00_F.xls" %then %do;&lt;BR /&gt;
%formatReportDetail(dsn=&amp;amp;dsn, worksheet=Sheet1);%end;&lt;BR /&gt;
%if "&amp;amp;file" EQ "&amp;amp;project._00_E.xls" %then %do;&lt;BR /&gt;
%formatReportVIPSummary(dsn=&amp;amp;dsn, worksheet=Sheet1);%end;&lt;BR /&gt;
%if "&amp;amp;file" EQ "&amp;amp;project._00_F.xls" %then %do;&lt;BR /&gt;
%formatReportRepProductivity(dsn=&amp;amp;dsn, worksheet=Sheet1);%end;&lt;BR /&gt;
%dde_closeSave(thepath=&amp;amp;path, thefile=&amp;amp;file);&lt;BR /&gt;
%mend dde_process;&lt;BR /&gt;
&lt;BR /&gt;
/*Report E*/&lt;BR /&gt;
%dde_process(st=NY, dsn=VIPsumNY, file=&amp;amp;project._00_E.xls)&lt;BR /&gt;
/*Report F*/&lt;BR /&gt;
%dde_process(st=NY, dsn=mhs2, file=&amp;amp;project._00_F.xls)

Message was edited by: raveena</description>
      <pubDate>Fri, 18 Mar 2011 14:44:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/DDE-Error/m-p/32982#M4843</guid>
      <dc:creator>raveena</dc:creator>
      <dc:date>2011-03-18T14:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: DDE Error</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/DDE-Error/m-p/32983#M4844</link>
      <description>Raveena&lt;BR /&gt;
&lt;BR /&gt;
Strange dde  as i don't see any data step reading or writing upon an excel sheet&lt;BR /&gt;
but i can reproduce your error&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
36   %let thepath=d:\temp; %let thefile=raveena.xls;&lt;BR /&gt;
37   %dde_makeWorkbook ;&lt;BR /&gt;
MPRINT(DDE_MAKEWORKBOOK):   filename sas2xl dde 'excel|system';&lt;BR /&gt;
MPRINT(DDE_MAKEWORKBOOK):   filename DDEcmds dde 'excel|system';&lt;BR /&gt;
MPRINT(DDE_MAKEWORKBOOK):   * reference for spreadsheet manipulation;&lt;BR /&gt;
MPRINT(DDE_MAKEWORKBOOK):   data _null_;&lt;BR /&gt;
MPRINT(DDE_MAKEWORKBOOK):   file sas2xl;&lt;BR /&gt;
MPRINT(DDE_MAKEWORKBOOK):   put '[error(false)]';&lt;BR /&gt;
MPRINT(DDE_MAKEWORKBOOK):   put '[save.as("\")]';&lt;BR /&gt;
MPRINT(DDE_MAKEWORKBOOK):   * save as ;&lt;BR /&gt;
MPRINT(DDE_MAKEWORKBOOK):   run;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: Le fichier SAS2XL est :&lt;BR /&gt;
      Session DDE,&lt;BR /&gt;
      SESSION=excel|system,RECFM=V,LRECL=256&lt;BR /&gt;
&lt;BR /&gt;
ERROR: Session DDE n'est pas prête.&lt;BR /&gt;
FATAL: Erreur d'E/S irrécupérable détectée lors de l'exécution de l'étape DATA.&lt;BR /&gt;
       Interrompu pendant la phase EXECUTION.&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
ilf i submit after&lt;BR /&gt;
[pre]&lt;BR /&gt;
%symdel thepath;&lt;BR /&gt;
%symdel thefile;&lt;BR /&gt;
&lt;BR /&gt;
%macro dde_makeWorkbook(thepath=,thefile=);&lt;BR /&gt;
filename sas2xl dde 'excel|system';&lt;BR /&gt;
filename DDEcmds dde 'excel|system'; * reference for spreadsheet manipulation;&lt;BR /&gt;
data _null_;&lt;BR /&gt;
file sas2xl;&lt;BR /&gt;
put '[error(false)]';&lt;BR /&gt;
put %unquote(%bquote('[save.as("&amp;amp;thepath.\&amp;amp;thefile.")]')); * save as ;&lt;BR /&gt;
run;&lt;BR /&gt;
%mend dde_makeWorkbook;&lt;BR /&gt;
&lt;BR /&gt;
%dde_makeWorkbook(thepath=d:\temp,thefile=raveena.xls) ;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
then there is no error&lt;BR /&gt;
&lt;BR /&gt;
Are knowing macro language or only applying a code made by someboty else?&lt;BR /&gt;
&lt;BR /&gt;
The suggestion of Cynthia was :  direct to technical support&lt;BR /&gt;
&lt;BR /&gt;
Andre</description>
      <pubDate>Fri, 18 Mar 2011 15:02:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/DDE-Error/m-p/32983#M4844</guid>
      <dc:creator>Andre</dc:creator>
      <dc:date>2011-03-18T15:02:31Z</dc:date>
    </item>
  </channel>
</rss>

