<?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: How do I export into a pipe delimited text file with text qualifiers in SAS EG? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/619393#M181838</link>
    <description>&lt;P&gt;Also, a separate question but in a similar vein:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to search my final sas dataset for a pipe delimiter? If I can incorporate this search, then I could forgo the text qualifier.&lt;/P&gt;</description>
    <pubDate>Thu, 23 Jan 2020 01:34:08 GMT</pubDate>
    <dc:creator>Mdxolly</dc:creator>
    <dc:date>2020-01-23T01:34:08Z</dc:date>
    <item>
      <title>How do I export into a pipe delimited text file with text qualifiers in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/619378#M181829</link>
      <description>&lt;P&gt;I have a SAS EG dataset that I've created through a series of SAS programs that I'm ready to export out to a text file (.txt). The problem is the requester is looking for a pipe delimited file with double quote (" ") text qualifiers around each value and each variable name. How do I do that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried going thru the export button on the final dataset I've created but SAS EG won't allow me to choose a pipe delimiter or even a text qualifier.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If there's no easy way to do this, how can I search my large dataset if there's a pipe symbol ( | ) in any of the values?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 00:08:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/619378#M181829</guid>
      <dc:creator>Mdxolly</dc:creator>
      <dc:date>2020-01-23T00:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: How do I export into a pipe delimited text file with text qualifiers in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/619383#M181833</link>
      <description>&lt;P&gt;You may need to clarify that each an every value, including numeric especially, needs to be quoted. Typically for most purposes the quotes are needed only for values that might contain the delimiter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since your described output is slightly nonstandard you have a couple of choices. One is to write a data _null_ step from scratch creating quoted values and then using PUT statements with the values to create the output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or possibly use Proc Export to create a delimited text file. The proc will write a data _null_ step to the log that you can modify.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A starting example:&lt;/P&gt;
&lt;PRE&gt;Proc export data=sashelp.class
      outfile= "x:\data\filename.txt"
      dbms=dlm
     replace;
      delimiter="|" ;
run;&lt;/PRE&gt;
&lt;P&gt;Will create a delimited file but the contents will look like:&lt;/P&gt;
&lt;PRE&gt;Name|Sex|Age|Height|Weight
Alice|F|13|56.5|84
Barbara|F|13|65.3|98
Carol|F|14|62.8|102.5
Jane|F|12|59.8|84.5
Janet|F|15|62.5|112.5&lt;/PRE&gt;
&lt;P&gt;The log will have code that looks like&lt;/P&gt;
&lt;PRE&gt;5543      data _null_;
5544      %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
5545      %let _EFIREC_ = 0;     /* clear export record count macro variable */
5546      file 'x:\data\filename.txt' delimiter='|' DSD DROPOVER lrecl=32767;
5547      if _n_ = 1 then        /* write column names or labels */
5548       do;
5549         put
5550            "Name"
5551         '|'
5552            "Sex"
5553         '|'
5554            "Age"
5555         '|'
5556            "Height"
5557         '|'
5558            "Weight"
5559         ;
5560       end;
5561     set  SASHELP.CLASS   end=EFIEOD;
5562         format Name $8. ;
5563         format Sex $1. ;
5564         format Age best12. ;
5565         format Height best12. ;
5566         format Weight best12. ;
5567       do;
5568         EFIOUT + 1;
5569         put Name $ @;
5570         put Sex $ @;
5571         put Age @;
5572         put Height @;
5573         put Weight ;
5574         ;
5575       end;
5576      if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable */
5577      if EFIEOD then call symputx('_EFIREC_',EFIOUT);
5578      run;
&lt;/PRE&gt;
&lt;P&gt;You can copy that code into the editor as a code node and modify it to write the values as desired.&lt;/P&gt;
&lt;P&gt;An incomplete example could be&lt;/P&gt;
&lt;PRE&gt;data _null_;
%let _EFIERR_ = 0; /* set the ERROR detection macro variable */
%let _EFIREC_ = 0;     /* clear export record count macro variable */
file 'x:\data\filename.txt' delimiter='|' 
      DROPOVER lrecl=32767;
if _n_ = 1 then        /* write column names or labels */
 do;
   put
      '"Name"'
   '|'
      '"Sex"'
   '|'
      '"Age"'
   '|'
      '"Height"'
   '|'
      '"Weight"'
   ;
 end;
set  SASHELP.CLASS   end=EFIEOD;
   format Name $8. ;
   format Sex $1. ;
   format Age f2. ;
   format Height best12. ;
   format Weight best12. ;
 do;
   EFIOUT + 1;
   nametext= quote(strip(name));
   sextext= quote(strip(sex));
   agetext= quote(put(age,f2.));
   Heighttext=   quote(strip(put(height,best6.)));
   put nametext  @;
   put Sextext  @;
   put Agetext @;
   put Heighttext @;
   put Weight ;
   ;
 end;
if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable */
if EFIEOD then call symputx('_EFIREC_',EFIOUT);
run;


&lt;/PRE&gt;
&lt;P&gt;I'm sure there are lots of other ways as well but most will involve some combination of string creation and manipulation then writing to the file.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 00:40:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/619383#M181833</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-01-23T00:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I export into a pipe delimited text file with text qualifiers in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/619389#M181836</link>
      <description>&lt;P&gt;Thank you for that. Is the difference between the log and the modified log that you included single quotes around the double quoted variables?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, where is the "editor as a code node"?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 01:01:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/619389#M181836</guid>
      <dc:creator>Mdxolly</dc:creator>
      <dc:date>2020-01-23T01:01:07Z</dc:date>
    </item>
    <item>
      <title>Re: How do I export into a pipe delimited text file with text qualifiers in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/619393#M181838</link>
      <description>&lt;P&gt;Also, a separate question but in a similar vein:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to search my final sas dataset for a pipe delimiter? If I can incorporate this search, then I could forgo the text qualifier.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 01:34:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/619393#M181838</guid>
      <dc:creator>Mdxolly</dc:creator>
      <dc:date>2020-01-23T01:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I export into a pipe delimited text file with text qualifiers in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/619401#M181842</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data clean;
set sashelp.cars;

*convert all characters to quoted;
array myvars(*) _character_;
do i=1 to dim(myvars);
myvars(i) = quote(trim(myvars(i)));
end;

file '/folders/myfolders/demo.txt' dlm='|';
put (_all_) (:) ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This will work - but you'll need to ensure your variables have the appropriate length to handle two extra characters for the quotes. If not, you'll need a different approach.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to search the file for the existence of any pipes, you could export it via CSV and search that file, via CTRL+F or if you want to use SAS to search the INDEX() function within a computed column in a query can do that for you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 04:04:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/619401#M181842</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-01-23T04:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do I export into a pipe delimited text file with text qualifiers in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/619424#M181847</link>
      <description>&lt;P&gt;See a simple example for exporting SASHELP.CLASS in this way:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set sashelp.class;
file '$HOME/sascommunity/class.txt';
if _n_ = 1 then put '"Name"|"Sex"|"Age"|"Height"|"Weight"';
line = catx('|',name,sex,age,height,weight);
line = cats('"',tranwrd(line,'|','"|"'),'"');
put line;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For your dataset, it may be necessary to set a sufficient length for variable line and also a &lt;FONT face="courier new,courier"&gt;lrecl=&lt;/FONT&gt; in the &lt;FONT face="courier new,courier"&gt;file&lt;/FONT&gt; statement.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 07:12:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/619424#M181847</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-01-23T07:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do I export into a pipe delimited text file with text qualifiers in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/619492#M181900</link>
      <description>&lt;P&gt;The first response would be back to the requester as to why they would want such a format.&amp;nbsp; Perhaps they just think they need it because they misunderstood the reason that quotes are needed when a particular value includes the delimiter character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you need quotes around ALL values? Or only around the character variable values? Around all values is easier.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the ~ modifier in the PUT statement to have SAS adds quotes, even when they are not required.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use a simple program like this to write the data for all variables with quotes.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  file myfile dsd dlm='|';
  set sashelp.class ;
  put (_all_) (~);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you need to add a header line then just write that first and then use the MOD option on the FILE statement on the step that writes the data lines.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let dsn=sashelp.class ;
filename myfile 'physical file name.txt';

proc transpose data=&amp;amp;dsn(obs=0) out=names ;
  var _all_;
run;

data _null_;
  file myfile dsd dlm='|';
  set names end=eof;
  put _name_ ~ @;
  if eof then put;
run;

data _null_;
  set &amp;amp;dsn ;
  file myfile dsd dlm='|' mod;
  put (_all_) (~);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You really shouldn't need to worry about whether any of the values in your data include actual pipe characters since you have already enclosed all of the values in quotes.&amp;nbsp; But if whatever program that is reading the file is stupid enough to require quotes around all values then might also not understand how to handle values with embedded quote characters.&amp;nbsp; If you have can actual double quote character in a value then SAS will double those characters so that the resulting string can be parsed.&amp;nbsp; So&lt;/P&gt;
&lt;PRE&gt;He said "hello" to me.&lt;/PRE&gt;
&lt;P&gt;When quoted will become&lt;/P&gt;
&lt;PRE&gt;"He said ""hello"" to me."&lt;/PRE&gt;
&lt;P&gt;To scan all character variables in a dataset looking for particular character(s) you probably want to use an array.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set &amp;amp;dsn ;
  array _c _character_;
  do index=1 to dim(_c);
    if indexc(_c[index],'"|') then put _n_= _c[index]= ;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jan 2020 13:23:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/619492#M181900</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-01-23T13:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: How do I export into a pipe delimited text file with text qualifiers in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/619628#M181976</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this solution almost worked - it's missing the variable names (which I need in double quotes) and some of the missing values are a set of two double quotes while other missing values are represented by a single double quote which is shown below. Do you know why that is?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="screenshot.png" style="width: 410px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/35578i2B3EAEDE8F0E6547/image-dimensions/410x186?v=v2" width="410" height="186" role="button" title="screenshot.png" alt="screenshot.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 18:39:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/619628#M181976</guid>
      <dc:creator>Mdxolly</dc:creator>
      <dc:date>2020-01-23T18:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do I export into a pipe delimited text file with text qualifiers in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/619638#M181982</link>
      <description>&lt;P&gt;You are getting single quote character because you cannot put three characters into a field that is only one character long.&amp;nbsp; If you want to use that method of individually adding quotes to values then you need to make sure the variable has room for the quoted value.&amp;nbsp; It would be better to loop over the variables and put the quoted value into a new variable.&amp;nbsp; re-using it as you go across the row.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also how does you system want missing values to be represented?&amp;nbsp; Is it different for missing character values and missing numeric values?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Also please let us know what system you are going to load this text file into&lt;/STRONG&gt;.&amp;nbsp; If it is commercially available software perhaps it has settings to allow it to read a normal delimited file instead of one with so many unnecessary quote characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 19:07:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/619638#M181982</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-01-23T19:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: How do I export into a pipe delimited text file with text qualifiers in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/619656#M181989</link>
      <description>&lt;P&gt;On second thought all of this is overkill. If SAS find the delimiter in the field it will automatically quote that field for you.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This demonstrates the issue, so you can use the PROC EXPORT as I have it below and know that it will correctly export your data for a system. If your requirement is you must have quotes around every variable then use&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;solution which is cleaner.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data demo;
set sashelp.class;
if name in ('Alfred', 'Jane') then  name = 'REP|Name';
run;

proc export data=demo file='/home/fkhurshed/Demo1/demo.txt' dbms=dlm replace;
delimiter='|';
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jan 2020 19:58:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/619656#M181989</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-01-23T19:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do I export into a pipe delimited text file with text qualifiers in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/619660#M181993</link>
      <description>&lt;P&gt;If the requirement is just to quote the character values, and not the numeric values, then try ODS CSV.&amp;nbsp; You can use teh DELIMITER option to ask it to use | instead comma.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods csv file=csv options(delimiter='|');
options missing=' ';
proc print data=test; run;
ods csv close;
options missing='.';&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jan 2020 20:15:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/619660#M181993</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-01-23T20:15:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do I export into a pipe delimited text file with text qualifiers in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/763961#M241955</link>
      <description>&lt;P&gt;I received the same kind of file request and this method works perfectly with one minor issue - null values appear in the output as a space (" ") instead of just two double quotes ("").&amp;nbsp; The space is causing the upload to their system to fail.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea how to remove these spaces?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Aug 2021 18:56:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/763961#M241955</guid>
      <dc:creator>Adumb</dc:creator>
      <dc:date>2021-08-25T18:56:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I export into a pipe delimited text file with text qualifiers in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/763970#M241959</link>
      <description>&lt;PRE&gt;ods csv file=csv options(delimiter='|');
&lt;FONT size="4" color="#FF0000"&gt;&lt;STRONG&gt;options missing=' ';&lt;/STRONG&gt;&lt;/FONT&gt;
proc print data=test; run;
ods csv close;
options missing='.';&lt;/PRE&gt;
&lt;P&gt;Looking closely at the code, try changing the line in red and see if you can find a solution that works for you.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/394780"&gt;@Adumb&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I received the same kind of file request and this method works perfectly with one minor issue - null values appear in the output as a space (" ") instead of just two double quotes ("").&amp;nbsp; The space is causing the upload to their system to fail.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any idea how to remove these spaces?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Thank you in advance.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Aug 2021 19:21:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/763970#M241959</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-08-25T19:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I export into a pipe delimited text file with text qualifiers in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/763972#M241960</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/394780"&gt;@Adumb&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I received the same kind of file request and this method works perfectly with one minor issue - null values appear in the output as a space (" ") instead of just two double quotes ("").&amp;nbsp; The space is causing the upload to their system to fail.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any idea how to remove these spaces?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Thank you in advance.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;First question is what system is imposing such restrictions on the CSV file format? Let's name and shame them. If no one complains they will never fix it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you require missing character variables to appear as&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;"abc"|""|"ghi"&lt;/PRE&gt;
&lt;P&gt;Instead of either of these?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;"abc"|" "|"ghi"
"abc"||"ghi"&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What about missing numeric values?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also does this mean you need to worry that the system might also be storing significant trailing spaces into character variables?&amp;nbsp; That can cause a lot of confusion.&amp;nbsp; For example would it consider these two rows as being different?&lt;/P&gt;
&lt;PRE&gt;"abc"|"def"|"ghi"
"abc"|"def   "|"ghi"&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Aug 2021 19:24:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/763972#M241960</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-25T19:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do I export into a pipe delimited text file with text qualifiers in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/763987#M241961</link>
      <description>I'm new to this group and I'm hoping this is a one-off request. I send the file off to a different team so I'm not sure what they're using. I will certainly be asking more questions.&lt;BR /&gt;&lt;BR /&gt;Yes, this is the desired output:&lt;BR /&gt;"abc"|""|"ghi"&lt;BR /&gt;&lt;BR /&gt;Currently I'm getting this:&lt;BR /&gt;"abc"|" "|"ghi"</description>
      <pubDate>Wed, 25 Aug 2021 19:46:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/763987#M241961</guid>
      <dc:creator>Adumb</dc:creator>
      <dc:date>2021-08-25T19:46:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I export into a pipe delimited text file with text qualifiers in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/763988#M241962</link>
      <description>&lt;P&gt;You could try making your own format that writes blank as bare quotes and then use that without the DSD option.&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value $equote (max=32767)
 ' '='""'
 other=[$quote.]
;
run;

data test;
  infile cards dsd truncover;
  input (c1-c3) (:$30.) n1-n3 ;
  file log dlm=',';
  format _character_ $equote.;
  put c1-c3 n1-n3 ;
cards;
1,2,3,4,5,6
a,b,,7,,9
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;"1","2","3",4,5,6
"a","b","",7,.,9
&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Aug 2021 19:48:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/763988#M241962</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-25T19:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I export into a pipe delimited text file with text qualifiers in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/764042#M241966</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/394780"&gt;@Adumb&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I'm new to this group and I'm hoping this is a one-off request. I send the file off to a different team so I'm not sure what they're using. I will certainly be asking more questions.&lt;BR /&gt;&lt;BR /&gt;Yes, this is the desired output:&lt;BR /&gt;"abc"|""|"ghi"&lt;BR /&gt;&lt;BR /&gt;Currently I'm getting this:&lt;BR /&gt;"abc"|" "|"ghi"&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You can also try giving them a file that does not have any of the unnecessary quotes.&lt;/P&gt;
&lt;PRE&gt;abc||ghi&lt;/PRE&gt;
&lt;P&gt;There is no reason to have quotes unless the value contains the delimiter (or quotes).&lt;/P&gt;</description>
      <pubDate>Wed, 25 Aug 2021 21:15:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/764042#M241966</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-25T21:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do I export into a pipe delimited text file with text qualifiers in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/764120#M242002</link>
      <description>&lt;P&gt;An easier option:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data CLEAN;
  set SASHELP.CARS;
  format _character_ quote30.;
  file "&amp;amp;wdir/demo.txt" dlm='|';
  put (_all_) (:) ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 08:01:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-into-a-pipe-delimited-text-file-with-text/m-p/764120#M242002</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-08-26T08:01:13Z</dc:date>
    </item>
  </channel>
</rss>

