<?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: Getting rid of comma at the end of a variable with multiple lengths in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Getting-rid-of-comma-at-the-end-of-a-variable-with-multiple/m-p/460238#M14254</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input VarA $10.;
want=prxchange('s/,+$//',1,strip(vara));
cards;
Yes,
No,
1.2,
1,
3.5,
High,
;
proc print noobs;run;


&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 05 May 2018 10:45:09 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2018-05-05T10:45:09Z</dc:date>
    <item>
      <title>Getting rid of comma at the end of a variable with multiple lengths</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Getting-rid-of-comma-at-the-end-of-a-variable-with-multiple/m-p/460173#M14247</link>
      <description>&lt;P&gt;I imported a "|" delimited file using proc import. Import says it imported the file successfully. I checked the number of observation and looks good to me. However, the variable at the end of the dataset has ",". For e.g.:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;VarA&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Yes,&lt;/P&gt;&lt;P&gt;No,&lt;/P&gt;&lt;P&gt;1.2,&lt;/P&gt;&lt;P&gt;1,&lt;/P&gt;&lt;P&gt;3.5,&lt;/P&gt;&lt;P&gt;High,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if you could provide me a way to get rid of the&amp;nbsp;"," at the end that would be great.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 May 2018 20:47:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Getting-rid-of-comma-at-the-end-of-a-variable-with-multiple/m-p/460173#M14247</guid>
      <dc:creator>pmpradhan</dc:creator>
      <dc:date>2018-05-04T20:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: Getting rid of comma at the end of a variable with multiple lengths</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Getting-rid-of-comma-at-the-end-of-a-variable-with-multiple/m-p/460178#M14248</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input VarA $10.;
cards;
Yes,
No,
1.2,
1,
3.5,
High,
;

data want;
set have;
substr(vara,length(VarA),1)=' ';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 May 2018 20:57:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Getting-rid-of-comma-at-the-end-of-a-variable-with-multiple/m-p/460178#M14248</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-05-04T20:57:16Z</dc:date>
    </item>
    <item>
      <title>Re: Getting rid of comma at the end of a variable with multiple lengths</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Getting-rid-of-comma-at-the-end-of-a-variable-with-multiple/m-p/460182#M14249</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/105450"&gt;@pmpradhan&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I imported a "|" delimited file using proc import. Import says it imported the file successfully. I checked the number of observation and looks good to me. However, the variable at the end of the dataset has ",". For e.g.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;VarA&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Yes,&lt;/P&gt;
&lt;P&gt;No,&lt;/P&gt;
&lt;P&gt;1.2,&lt;/P&gt;
&lt;P&gt;1,&lt;/P&gt;
&lt;P&gt;3.5,&lt;/P&gt;
&lt;P&gt;High,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if you could provide me a way to get rid of the&amp;nbsp;"," at the end that would be great.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;PROC IMPORT guesses at what it does. It does not always guess successfully. Given that the data does not meet your requirements you're better off modifying your process to import the file cleanly in the first place.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Usually you can get the code from the log and modify it. I noticed that you're posting in the DataFlux forum so I assume you're using DI studio?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 May 2018 21:07:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Getting-rid-of-comma-at-the-end-of-a-variable-with-multiple/m-p/460182#M14249</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-05-04T21:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: Getting rid of comma at the end of a variable with multiple lengths</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Getting-rid-of-comma-at-the-end-of-a-variable-with-multiple/m-p/460238#M14254</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input VarA $10.;
want=prxchange('s/,+$//',1,strip(vara));
cards;
Yes,
No,
1.2,
1,
3.5,
High,
;
proc print noobs;run;


&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 05 May 2018 10:45:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Getting-rid-of-comma-at-the-end-of-a-variable-with-multiple/m-p/460238#M14254</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-05-05T10:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: Getting rid of comma at the end of a variable with multiple lengths</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Getting-rid-of-comma-at-the-end-of-a-variable-with-multiple/m-p/460261#M14255</link>
      <description>&lt;P&gt;Unless you want to remove multiple commas at the end of each variable's value, I'd suggest a minor change to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;'s suggested code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input VarA $10.;
  want=prxchange('s/,$//',1,strip(vara));
  cards;
Yes,,
No,
1.2,
1,
3.5,
High,
Other
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 May 2018 18:59:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Getting-rid-of-comma-at-the-end-of-a-variable-with-multiple/m-p/460261#M14255</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-05-05T18:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: Getting rid of comma at the end of a variable with multiple lengths</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Getting-rid-of-comma-at-the-end-of-a-variable-with-multiple/m-p/461686#M14334</link>
      <description>&lt;P&gt;Thank you for speedy and simple solution! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 May 2018 20:01:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Getting-rid-of-comma-at-the-end-of-a-variable-with-multiple/m-p/461686#M14334</guid>
      <dc:creator>pmpradhan</dc:creator>
      <dc:date>2018-05-11T20:01:33Z</dc:date>
    </item>
  </channel>
</rss>

