<?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: Character variable is a period, how to delete? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Character-variable-is-a-period-how-to-delete/m-p/111251#M259007</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This code worked:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if left(HCPCS)='.' then delete;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THANK YOU!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Jun 2013 20:38:03 GMT</pubDate>
    <dc:creator>Lefty</dc:creator>
    <dc:date>2013-06-18T20:38:03Z</dc:date>
    <item>
      <title>Character variable is a period, how to delete?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-variable-is-a-period-how-to-delete/m-p/111247#M259003</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a variable, HCPCS, that is usually numeric, but sometimes is alphanumeric (e.g. G0202). I am merging several wide datasets together, so most of them contain only numeric values for HCPCS but once I merge a file that has an alpha code, the HCPCS variable becomes a SAS-defined character variable. The problem is, when I make the data long, I would like to delete all the rows that have missing values for HCPCS, but since it's a character variable, I'm having trouble. I can delete the ones that are blank (if HCPCS=" " then delete) but when I try to delete the ones that are periods (.), they don't get deleted. I've tried if HCPCS="." then delete (which doesn't delete anything) and if HCPCS=. then delete (which converts HCPCS to a numeric variable and deletes all the codes with letters in them, which I don't want to lose).&lt;/P&gt;&lt;P&gt;ANy help would be greatly appreciated! Thanks.&lt;/P&gt;&lt;P&gt;Laurie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jun 2013 19:27:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-variable-is-a-period-how-to-delete/m-p/111247#M259003</guid>
      <dc:creator>Lefty</dc:creator>
      <dc:date>2013-06-18T19:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: Character variable is a period, how to delete?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-variable-is-a-period-how-to-delete/m-p/111248#M259004</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try:&lt;/P&gt;&lt;P&gt;if missing(HCPCS) then delete;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jun 2013 20:20:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-variable-is-a-period-how-to-delete/m-p/111248#M259004</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2013-06-18T20:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: Character variable is a period, how to delete?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-variable-is-a-period-how-to-delete/m-p/111249#M259005</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, I should have clarified, I tried that too. That only deleted the ones that were " " type missing. For all the ones that were . missing, they were still there. Thanks though.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jun 2013 20:26:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-variable-is-a-period-how-to-delete/m-p/111249#M259005</guid>
      <dc:creator>Lefty</dc:creator>
      <dc:date>2013-06-18T20:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Character variable is a period, how to delete?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-variable-is-a-period-how-to-delete/m-p/111250#M259006</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sounds like that you don't really have the control whther the variable is numeric or not. It should be possible to have that, or how does your merge operation look like?&lt;/P&gt;&lt;P&gt;If you are sure that HCPCS is char, try left(HCPCS) = '.', or just compress(HCPCS,'.') = ' '.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jun 2013 20:32:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-variable-is-a-period-how-to-delete/m-p/111250#M259006</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2013-06-18T20:32:14Z</dc:date>
    </item>
    <item>
      <title>Re: Character variable is a period, how to delete?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-variable-is-a-period-how-to-delete/m-p/111251#M259007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This code worked:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if left(HCPCS)='.' then delete;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THANK YOU!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jun 2013 20:38:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-variable-is-a-period-how-to-delete/m-p/111251#M259007</guid>
      <dc:creator>Lefty</dc:creator>
      <dc:date>2013-06-18T20:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: Character variable is a period, how to delete?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-variable-is-a-period-how-to-delete/m-p/111252#M259008</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When SAS does an automatic conversion from numeric to character you will see those types of right aligned values.&amp;nbsp; The worst is when the variable is longer than you screen size so when you browse the data it looks all blank.&amp;nbsp; Try this little example to see what is happening.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data check;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; length char $10 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; input x;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; char=x;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; put char= $quote. x=;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;cards;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the CATS() function to remove the leading blanks.&amp;nbsp; The nice thing is that it will work without errors or warnings with both character and numeric variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; set check;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; if cats(char) in (' ','.') then delete;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; put char= $quote. x=;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; set check;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; if cats(x) in (' ','.') then delete;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; put char= $quote. x=;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jun 2013 00:24:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-variable-is-a-period-how-to-delete/m-p/111252#M259008</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-06-19T00:24:17Z</dc:date>
    </item>
  </channel>
</rss>

