<?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: Compress Spaces while using PUT STATEMENT in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Compress-Spaces-while-using-PUT-STATEMENT/m-p/837873#M331316</link>
    <description>&lt;P&gt;Are attempting to create a specific file type such as JSON?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Oct 2022 15:41:41 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-10-11T15:41:41Z</dc:date>
    <item>
      <title>Compress Spaces while using PUT STATEMENT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compress-Spaces-while-using-PUT-STATEMENT/m-p/837803#M331280</link>
      <description>&lt;P&gt;I am creating a text files from SAS dataset, I used BEST32. for numeric variables. But upon using this I get lot of spaces in field values in text file due to this file size is increasing a lot. How i can compess these spaces.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ex -&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;}&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;999999998 }}&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 110 }&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;237.877 }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sample Code -&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;set ds_1;&lt;BR /&gt;file 'path' DSD lrecl=15000;&lt;BR /&gt;put FILE_CREATE_DT +(-1) "}" COUNTRY +(-1) "}" OPEN_DT +(-1) "}" OWN_NUM BEST32. +(+1) "}"&lt;BR /&gt;LIMIT BEST32. +(+1) "}" BAL BEST32. +(+1) "}" OWN_NAME;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2022 08:52:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compress-Spaces-while-using-PUT-STATEMENT/m-p/837803#M331280</guid>
      <dc:creator>PRAVIN_JAIN</dc:creator>
      <dc:date>2022-10-11T08:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: Compress Spaces while using PUT STATEMENT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compress-Spaces-while-using-PUT-STATEMENT/m-p/837804#M331281</link>
      <description>&lt;P&gt;First create a temporary variable with the whole string you wish to PUT.&lt;/P&gt;
&lt;P&gt;While doing so, you can the various trimming functions SAS offers, like CATS, CATX, TRIM, TRIMN, COMPRESS, LEFT etc.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2022 09:32:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compress-Spaces-while-using-PUT-STATEMENT/m-p/837804#M331281</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2022-10-11T09:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: Compress Spaces while using PUT STATEMENT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compress-Spaces-while-using-PUT-STATEMENT/m-p/837828#M331294</link>
      <description>Do NOT adding the format, just remove them.&lt;BR /&gt;&lt;BR /&gt;put LIMIT  +(+1) "}" BAL  +(+1) "}" OWN_NAME;</description>
      <pubDate>Tue, 11 Oct 2022 12:20:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compress-Spaces-while-using-PUT-STATEMENT/m-p/837828#M331294</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-10-11T12:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: Compress Spaces while using PUT STATEMENT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compress-Spaces-while-using-PUT-STATEMENT/m-p/837873#M331316</link>
      <description>&lt;P&gt;Are attempting to create a specific file type such as JSON?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2022 15:41:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compress-Spaces-while-using-PUT-STATEMENT/m-p/837873#M331316</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-10-11T15:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: Compress Spaces while using PUT STATEMENT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compress-Spaces-while-using-PUT-STATEMENT/m-p/837874#M331317</link>
      <description>&lt;P&gt;Use the : modifier to allow you to include a format specification in the PUT statement and yet still generate the result the same as if you used LIST MODE instead of FORMATTED mode.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;put
 FILE_CREATE_DT +(-1) "}" 
 COUNTRY +(-1) "}" 
 OPEN_DT +(-1) "}" 
 OWN_NUM :BEST32. +(-1) "}"
 LIMIT :BEST32. +(-1) "}" 
 BAL :BEST32. +(-1) "}" 
 OWN_NAME
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or simply attach the format to the variable and remove the format specification from the PUT statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;put
 FILE_CREATE_DT +(-1) "}" 
 COUNTRY +(-1) "}" 
 OPEN_DT +(-1) "}" 
 OWN_NUM  +(-1) "}"
 LIMIT  +(-1) "}" 
 BAL  +(-1) "}" 
 OWN_NAME
;
format OWN_NUM LIMIT BAL best32.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also since you seem to just want to generate '}' as the delimiter why not tell the FILE statement to do that?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set ds_1;
  file 'path' DSD dlm='}' lrecl=15000;
  put FILE_CREATE_DT COUNTRY OPEN_DT OWN_NUM LIMIT BAL OWN_NAME;
  format OWN_NUM LIMIT BAL best32.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Oct 2022 15:57:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compress-Spaces-while-using-PUT-STATEMENT/m-p/837874#M331317</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-10-11T15:57:49Z</dc:date>
    </item>
  </channel>
</rss>

