<?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: Proc export null values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-export-null-values/m-p/667227#M199750</link>
    <description>&lt;P&gt;Show your code. That shouldn't happen as described using PROC EXPORT.&lt;/P&gt;
&lt;P&gt;This generates a file as expected with the empty variables at the end.&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 class;
set sashelp.class;
y = .;
z = "";
t = "";
run;

proc export data=class outfile='./demo.txt' dbms=dlm replace;
delimiter = '|';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/182470"&gt;@helannivas88&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;HI,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Im trying to export a SAS dataset into .txt file using proc export and delimiter is pipe. In the SAS dataset ,there are totally 6 columns but the fourth column is null in all rows. So after export I can able to get only the first three columns in the .txt file, not the remaining three columns ( 04th ,05th ,06th)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I brought the null column into the first variable , then the .txt file is totally empty.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please let me know if I need to introduce any extra parameters in proc export to rectify this issue.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Jul 2020 16:19:09 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-07-06T16:19:09Z</dc:date>
    <item>
      <title>Proc export null values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-export-null-values/m-p/667223#M199748</link>
      <description>&lt;P&gt;HI,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Im trying to export a SAS dataset into .txt file using proc export and delimiter is pipe. In the SAS dataset ,there are totally 6 columns but the fourth column is null in all rows. So after export I can able to get only the first three columns in the .txt file, not the remaining three columns ( 04th ,05th ,06th)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I brought the null column into the first variable , then the .txt file is totally empty.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please let me know if I need to introduce any extra parameters in proc export to rectify this issue.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2020 16:07:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-export-null-values/m-p/667223#M199748</guid>
      <dc:creator>helannivas88</dc:creator>
      <dc:date>2020-07-06T16:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: Proc export null values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-export-null-values/m-p/667227#M199750</link>
      <description>&lt;P&gt;Show your code. That shouldn't happen as described using PROC EXPORT.&lt;/P&gt;
&lt;P&gt;This generates a file as expected with the empty variables at the end.&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 class;
set sashelp.class;
y = .;
z = "";
t = "";
run;

proc export data=class outfile='./demo.txt' dbms=dlm replace;
delimiter = '|';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/182470"&gt;@helannivas88&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;HI,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Im trying to export a SAS dataset into .txt file using proc export and delimiter is pipe. In the SAS dataset ,there are totally 6 columns but the fourth column is null in all rows. So after export I can able to get only the first three columns in the .txt file, not the remaining three columns ( 04th ,05th ,06th)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I brought the null column into the first variable , then the .txt file is totally empty.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please let me know if I need to introduce any extra parameters in proc export to rectify this issue.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2020 16:19:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-export-null-values/m-p/667227#M199750</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-07-06T16:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: Proc export null values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-export-null-values/m-p/667241#M199760</link>
      <description>&lt;P&gt;Please post example input data (in the form of data step), the code you ran, and example lines from the generated text file.&amp;nbsp; Make sure to use with the Insert Code (icon looks like the text &amp;lt; / &amp;gt;) or Insert SAS code (looks like the SAS submit, or running person, icon) buttons when adding the text to your post.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2020 16:57:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-export-null-values/m-p/667241#M199760</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-07-06T16:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: Proc export null values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-export-null-values/m-p/667391#M199845</link>
      <description>&lt;P&gt;Below is my code. Just I do a direct hit to SQL server database and create a SAS dataset and then load into a file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the intermediate SAS dataset, I could see all the columns are populated correctly but not in the .txt file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc format ;&lt;BR /&gt;picture datetimefmt &lt;BR /&gt;low-high = '%Y-%0m-%0d %0H:%0M:%0s' (datatype=datetime )&lt;BR /&gt;other = .;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc format ;&lt;BR /&gt;picture timefmt &lt;BR /&gt;low-high = '%0H:%0M:%0S' (datatype=time )&lt;BR /&gt;other = .;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc format ;&lt;BR /&gt;picture datefmt &lt;BR /&gt;low-high = '%Y-%0m-%0d' (datatype=date)&lt;BR /&gt;other = .;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;connect to SQLSVR as SRC (datasrc="&amp;amp;Datasrc" AUTHDOMAIN="XXX");&lt;BR /&gt;exec &lt;BR /&gt;(&lt;BR /&gt;SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED&lt;BR /&gt;) by SRC;&lt;BR /&gt;&lt;BR /&gt;create table WORK.TEMP as &lt;BR /&gt;select&lt;BR /&gt;CONTEXTID ,&lt;BR /&gt;RREF ,&lt;BR /&gt;DTTM format datetimefmt26.6,&lt;BR /&gt;TS length=25 format=$25. , &lt;BR /&gt;MONOTONIC() AS ROW_NUM, &lt;BR /&gt;input("&amp;amp;SYSDATE9 &amp;amp;SYSTIME",DATETIME25.6) as STG_LOADTM format datetimefmt26.6&lt;BR /&gt;from connection to SRC&lt;BR /&gt;(&lt;BR /&gt;select * from &amp;amp;Schema..REL&lt;BR /&gt;);&lt;BR /&gt;disconnect from SRC;&lt;BR /&gt;alter table WORK.TEMP&lt;BR /&gt;modify ts char(16) informat=$16. format=$16.; &lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%let LOG_DIR=%unquote(%str(%')&amp;amp;_LOGDIR%str(%'));&lt;BR /&gt;%let SRC_FEED=TEMP.txt;&lt;BR /&gt;%let SOURCE_FILE=%unquote(%str(%')&amp;amp;_SRCDIR/&amp;amp;SRC_FEED%str(%'));&lt;/P&gt;
&lt;P&gt;proc export data=work.TEMP&lt;BR /&gt;outfile="&amp;amp;SOURCE_FILE"&lt;BR /&gt;dbms=dlm replace;&lt;BR /&gt;PUTNAMES=NO;&lt;BR /&gt;delimiter='|';&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2020 10:31:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-export-null-values/m-p/667391#M199845</guid>
      <dc:creator>helannivas88</dc:creator>
      <dc:date>2020-07-07T10:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: Proc export null values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-export-null-values/m-p/667422#M199861</link>
      <description>&lt;P&gt;Show the values of the SAS datasets and the lines of text in the file generated by PROC EXPORT.&lt;/P&gt;
&lt;P&gt;One possible issue is that you are originally created TS as LENGTH=25 and then later truncating it to 16 characters.&amp;nbsp; So if the values in the remote database have blanks in the first 16 characters then the result of trimming it will always be blank.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;...
 , TS length=25 format=$25. 
...
alter table WORK.TEMP
  modify ts char(16) informat=$16. format=$16.
;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Jul 2020 12:13:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-export-null-values/m-p/667422#M199861</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-07-07T12:13:30Z</dc:date>
    </item>
  </channel>
</rss>

