<?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 to get rid of blanks when exporting to .csv in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-blanks-when-exporting-to-csv/m-p/907506#M358221</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19791"&gt;@Filipvdr&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can add a&amp;nbsp;"@"&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n1spe7nmkmi7ywn175002rof97fv.htm#n1uo30njxxdx7in1f117hqa5q33q" target="_blank" rel="noopener"&gt;line-hold specifier&lt;/A&gt;&amp;nbsp;to&amp;nbsp;the PUT statement, then remove the blanks by modifying the content of the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n15o12lpyoe4gfn1y1vcp6xs6966.htm#n063uv3ff4rz00n1upyr6w6895i8" target="_blank" rel="noopener"&gt;_FILE_ variable&lt;/A&gt; and finally write the modified text to the output file with a second PUT statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example using a SASHELP dataset:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set sashelp.heart(firstobs=500 obs=505);
file print dsd dlm=';';
put (_all_) (~) @;
_file_=tranwrd(_file_,'" "','""');
put;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;"Alive";&lt;FONT color="#FF00FF"&gt;""&lt;/FONT&gt;;".";"Female";"40";"63.25";"119";"82";"156";"99";"0";".";"184";"Desirable";"High";"Normal";"Non-smoker"
"Alive";&lt;FONT color="#FF00FF"&gt;""&lt;/FONT&gt;;".";"Female";"35";"60.5";"108";"82";"128";"99";"5";".";".";&lt;FONT color="#FF00FF"&gt;""&lt;/FONT&gt;;"Normal";"Normal";"Light (1-5)"
"Alive";&lt;FONT color="#FF00FF"&gt;""&lt;/FONT&gt;;".";"Male";"49";"67.5";"169";"88";"152";"121";"0";".";"246";"High";"High";"Overweight";"Non-smoker"
"Alive";&lt;FONT color="#FF00FF"&gt;""&lt;/FONT&gt;;".";"Male";"32";"66.25";"203";"82";"134";"150";"45";".";"179";"Desirable";"Normal";"Overweight";"Very Heavy (&amp;gt; 25)"
"Alive";&lt;FONT color="#FF00FF"&gt;""&lt;/FONT&gt;;".";"Female";"45";"66";"127";"96";"148";"96";".";".";".";&lt;FONT color="#FF00FF"&gt;""&lt;/FONT&gt;;"High";"Normal";&lt;FONT color="#FF00FF"&gt;""&lt;/FONT&gt;
"Alive";&lt;FONT color="#FF00FF"&gt;""&lt;/FONT&gt;;".";"Female";"32";"60";"108";"62";"130";"99";"0";".";".";&lt;FONT color="#FF00FF"&gt;""&lt;/FONT&gt;;"Normal";"Normal";"Non-smoker"&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note the added parentheses around &lt;FONT face="courier new,courier"&gt;_all_&lt;/FONT&gt;&amp;nbsp;to correct the first PUT statement.&lt;/P&gt;</description>
    <pubDate>Tue, 12 Dec 2023 12:05:33 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2023-12-12T12:05:33Z</dc:date>
    <item>
      <title>How to get rid of blanks when exporting to .csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-blanks-when-exporting-to-csv/m-p/907487#M358206</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I got the following code which exports a .csv file.&lt;/P&gt;
&lt;P&gt;The problem is for blank character values i'm getting&amp;nbsp;;" "; a space.&lt;/P&gt;
&lt;P&gt;How to get rid of this space, i want to keep the quotes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename  exprt "/opt/sas/config/Lev1/SASApp/Userdata/ELYSE/Gebouwen_&amp;amp;t_org_id._&amp;amp;current_datetime..csv" encoding="utf-8";

data _null_;
	file exprt dsd dlm=";";
    set temp ;
    put _label_ @;
run;
data _null_;
  set "QUERY_export gebouwen"n;
  file exprt dsd dlm=";" mod;
  put _ALL_ (~);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Dec 2023 10:53:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-blanks-when-exporting-to-csv/m-p/907487#M358206</guid>
      <dc:creator>Filipvdr</dc:creator>
      <dc:date>2023-12-12T10:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of blanks when exporting to .csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-blanks-when-exporting-to-csv/m-p/907506#M358221</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19791"&gt;@Filipvdr&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can add a&amp;nbsp;"@"&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n1spe7nmkmi7ywn175002rof97fv.htm#n1uo30njxxdx7in1f117hqa5q33q" target="_blank" rel="noopener"&gt;line-hold specifier&lt;/A&gt;&amp;nbsp;to&amp;nbsp;the PUT statement, then remove the blanks by modifying the content of the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n15o12lpyoe4gfn1y1vcp6xs6966.htm#n063uv3ff4rz00n1upyr6w6895i8" target="_blank" rel="noopener"&gt;_FILE_ variable&lt;/A&gt; and finally write the modified text to the output file with a second PUT statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example using a SASHELP dataset:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set sashelp.heart(firstobs=500 obs=505);
file print dsd dlm=';';
put (_all_) (~) @;
_file_=tranwrd(_file_,'" "','""');
put;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;"Alive";&lt;FONT color="#FF00FF"&gt;""&lt;/FONT&gt;;".";"Female";"40";"63.25";"119";"82";"156";"99";"0";".";"184";"Desirable";"High";"Normal";"Non-smoker"
"Alive";&lt;FONT color="#FF00FF"&gt;""&lt;/FONT&gt;;".";"Female";"35";"60.5";"108";"82";"128";"99";"5";".";".";&lt;FONT color="#FF00FF"&gt;""&lt;/FONT&gt;;"Normal";"Normal";"Light (1-5)"
"Alive";&lt;FONT color="#FF00FF"&gt;""&lt;/FONT&gt;;".";"Male";"49";"67.5";"169";"88";"152";"121";"0";".";"246";"High";"High";"Overweight";"Non-smoker"
"Alive";&lt;FONT color="#FF00FF"&gt;""&lt;/FONT&gt;;".";"Male";"32";"66.25";"203";"82";"134";"150";"45";".";"179";"Desirable";"Normal";"Overweight";"Very Heavy (&amp;gt; 25)"
"Alive";&lt;FONT color="#FF00FF"&gt;""&lt;/FONT&gt;;".";"Female";"45";"66";"127";"96";"148";"96";".";".";".";&lt;FONT color="#FF00FF"&gt;""&lt;/FONT&gt;;"High";"Normal";&lt;FONT color="#FF00FF"&gt;""&lt;/FONT&gt;
"Alive";&lt;FONT color="#FF00FF"&gt;""&lt;/FONT&gt;;".";"Female";"32";"60";"108";"62";"130";"99";"0";".";".";&lt;FONT color="#FF00FF"&gt;""&lt;/FONT&gt;;"Normal";"Normal";"Non-smoker"&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note the added parentheses around &lt;FONT face="courier new,courier"&gt;_all_&lt;/FONT&gt;&amp;nbsp;to correct the first PUT statement.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 12:05:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-blanks-when-exporting-to-csv/m-p/907506#M358221</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2023-12-12T12:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of blanks when exporting to .csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-blanks-when-exporting-to-csv/m-p/907510#M358223</link>
      <description>Thanks, works perfect!</description>
      <pubDate>Tue, 12 Dec 2023 12:15:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-blanks-when-exporting-to-csv/m-p/907510#M358223</guid>
      <dc:creator>Filipvdr</dc:creator>
      <dc:date>2023-12-12T12:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of blanks when exporting to .csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-blanks-when-exporting-to-csv/m-p/907524#M358230</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
 set sashelp.class;
 if _n_=1 then call missing(sex,age);
run;


proc transpose data=have(obs=0) out=temp;
var _all_;
run;
proc sql noprint;
select catt("'",quote(strip(_name_)),"'") into :varname separated by '||";"||' from temp;
select catt('quote(strip(',_name_,'))') into :catx separated by '||";"||' from temp;
quit;
data _null_;
 file 'c:\temp\want.csv';
 set have;
 length _varname _temp $ 200;
 _varname=&amp;amp;varname.;
 _temp=&amp;amp;catx.;
 if _n_=1 then put _varname;
 put _temp;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1702385298811.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/91209iDABD1ADAFB5CF414/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1702385298811.png" alt="Ksharp_0-1702385298811.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 12:48:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-blanks-when-exporting-to-csv/m-p/907524#M358230</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-12-12T12:48:29Z</dc:date>
    </item>
  </channel>
</rss>

