<?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: Export SAS dataset with DDE: Broken lines in my xlsx output file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Export-SAS-dataset-with-DDE-Broken-lines-in-my-xlsx-output-file/m-p/250648#M47276</link>
    <description>Hi ballardw, Taking care of CR and LF solved the issue ! Thannks  saskapa</description>
    <pubDate>Wed, 17 Feb 2016 15:51:03 GMT</pubDate>
    <dc:creator>saskapa</dc:creator>
    <dc:date>2016-02-17T15:51:03Z</dc:date>
    <item>
      <title>Export SAS dataset with DDE: Broken lines in my xlsx output file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-SAS-dataset-with-DDE-Broken-lines-in-my-xlsx-output-file/m-p/250430#M47216</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have an issue with export a SAS dataset to excell by using DDE. That SAS dataset was originally import with from an excel file by using DDE as well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That excel file is a sepcification document with a column called 'Comment/Programming'. This column has contains a lot strings...&lt;/P&gt;
&lt;P&gt;When I imported &amp;nbsp;this xlsx file in SAS everything went file here is a section of the import :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data _null_;
 file ddecmd;
 put "[OPEN(""C:\MPE\WORKING\METADATA\DICTIONARIES\CRT\TEMPLATE\XLS\adam\metadata.xlsx"")]";
 dummy=sleep(5);
run;


filename xlin dde "excel|&amp;amp;domain.!R1C1:R500C11"  lrecl=30000;




********************************************************************************;
****                    PROCESSING  SAS DATASET                              ***;
********************************************************************************;


data metadata ;
 infile xlin dsd dlm='09'x missover  notab ;
 informat var1-var11 $800.;
 input var1-var11 $800.;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;No issue everything perfect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I use DDE to export&amp;nbsp;the file into excel with following code (macro):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro xCRTxls(path=,domain=,model=,col=);


options noxwait noxsync;

x '"C:\Program Files (x86)\Microsoft Office\Office14\excel.exe"'; 


filename  ddecmd DDE 'excel|system';

*give a little time for sas to access execel;
data _null_;
  dummy=sleep(2);
run;


*Then use a Excel macro command to pass Excell via SAS ;
*-------------------------------------------------------;

data _null_;
 file ddecmd;
 put "[OPEN(""&amp;amp;pathx.\template.xlsx"")]";
 dummy=sleep(5);
run;

/*Note that I could create in the template.xlsx those variables  It will imporve the process and speed it up !!*/

filename test dde "excel|Sheet1!R2C1:R60C&amp;amp;col."  notab  LRECL=MAX;

     
data _null_; 
 retain b (-1) t '09'x;
 set metaadam.&amp;amp;domain.;
 
 file test;

%if %upcase(&amp;amp;model.) eq SDTM %then %do;
 put variable t+b  label t+b len t+b type t+b ct t+b core t+b origin t+b /*notes t+b*/ programming_instruction t+b used t+b;
 %end;
%else %if %upcase(&amp;amp;model.) eq ADAM %then %do;
 put  Dataset t+b Variable t+b  Label t+b  Type t+b Length t+b CT t+b Origin t+b Role t+b Core t+b  Programming t+b;
%end;

 run;

data _null_;
 file ddecmd; 
 put "[Save.as(""&amp;amp;pathx.\&amp;amp;domain..xlsx"")]";
 put "[CLOSE(""&amp;amp;pathx.\&amp;amp;domain..xlsx"")]"; 
 dummy=sleep(3);
run;
 
%mend xCRTxls;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Everything worked fine except that I have values of 'programming' column&amp;nbsp;( column that contains a lot fo character..) that are splitted.Indeed a part of those values are written in the next row to the first column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The SAS log says however &amp;nbsp;that the maximum record length is&amp;nbsp;616.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have added the option DROPOVER to the file statement to see if it resolve the problem ( at cost of truncation ) but nothing changes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any idea what is happening and how to avoid this issue ?&lt;/P&gt;
&lt;P&gt;Any help would be helpful&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS_KAP&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2016 20:02:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-SAS-dataset-with-DDE-Broken-lines-in-my-xlsx-output-file/m-p/250430#M47216</guid>
      <dc:creator>saskapa</dc:creator>
      <dc:date>2016-02-16T20:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: Export SAS dataset with DDE: Broken lines in my xlsx output file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-SAS-dataset-with-DDE-Broken-lines-in-my-xlsx-output-file/m-p/250435#M47217</link>
      <description>&lt;P&gt;Usually the NOTAB option along with a LRECL setting avoids this issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you try setting LRECL to 1000 rather than MAX?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2016 20:05:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-SAS-dataset-with-DDE-Broken-lines-in-my-xlsx-output-file/m-p/250435#M47217</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-02-16T20:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: Export SAS dataset with DDE: Broken lines in my xlsx output file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-SAS-dataset-with-DDE-Broken-lines-in-my-xlsx-output-file/m-p/250436#M47218</link>
      <description>&lt;P&gt;Check the values of your Programming variable for things like Tabs, Carriage Returns or Line Feeds. They can have unexpected results on your output. If they are present, get rid of them.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2016 20:06:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-SAS-dataset-with-DDE-Broken-lines-in-my-xlsx-output-file/m-p/250436#M47218</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-02-16T20:06:46Z</dc:date>
    </item>
    <item>
      <title>Re: Export SAS dataset with DDE: Broken lines in my xlsx output file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-SAS-dataset-with-DDE-Broken-lines-in-my-xlsx-output-file/m-p/250648#M47276</link>
      <description>Hi ballardw, Taking care of CR and LF solved the issue ! Thannks  saskapa</description>
      <pubDate>Wed, 17 Feb 2016 15:51:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-SAS-dataset-with-DDE-Broken-lines-in-my-xlsx-output-file/m-p/250648#M47276</guid>
      <dc:creator>saskapa</dc:creator>
      <dc:date>2016-02-17T15:51:03Z</dc:date>
    </item>
  </channel>
</rss>

