<?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: Char to Numeric conversion: in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Char-to-Numeric-conversion/m-p/23433#M3895</link>
    <description>Also, I believe that your SAS log will reveal the variable value for "str" when your DO / END code is *NOT* executed.  And you are masking the condition by coding the "??" by the way which hinders your ability to debug your program when executed - not a good idea in my experience.&lt;BR /&gt;
&lt;BR /&gt;
And so I suggest you use the following SAS "debugging technique" statement in your program at the "end" of the DATA step and possibly adding it in other places (set the "nnn" value to identify your location in the program when invoked):&lt;BR /&gt;
&lt;BR /&gt;
PUTLOG "&amp;gt;TAGnnn&amp;gt;  I am here!" / _all_;&lt;BR /&gt;
&lt;BR /&gt;
And be sure that you have the maximum amount of SAS Log output generated by your program by coding:&lt;BR /&gt;
&lt;BR /&gt;
OPTIONS SOURCE SOURCE2;&lt;BR /&gt;
* OPTIONS MACROGEN SYMBOLGEN MPRINT; /* uncomment as needed */&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
    <pubDate>Sat, 25 Apr 2009 17:01:28 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2009-04-25T17:01:28Z</dc:date>
    <item>
      <title>Char to Numeric conversion:</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Char-to-Numeric-conversion/m-p/23431#M3893</link>
      <description>data jan2009_v1;&lt;BR /&gt;
     set jan2009(where=(drug_name like 'TRIATE%' or drug_name like 'SEIL%'));&lt;BR /&gt;
 drug_name=upcase(drug_name);&lt;BR /&gt;
   length str $ 7;&lt;BR /&gt;
	 if  _N_ = 1 then  RE = PRXPARSE("/ \d{1,5}\.?\d{0,4}/");&lt;BR /&gt;
	retain  RE;&lt;BR /&gt;
	call PRXSUBSTR(RE,drug_name,START,LENGTH);&lt;BR /&gt;
	if START GT 0 then  do;&lt;BR /&gt;
	str  = SUBSTRN(drug_name,START + 1,LENGTH - 1);&lt;BR /&gt;
	output;&lt;BR /&gt;
	end;&lt;BR /&gt;
  strength=input(str,??best12.); ------------Problem area!!&lt;BR /&gt;
  run;&lt;BR /&gt;
&lt;BR /&gt;
When I convert the str to numeric, I get missing values.&lt;BR /&gt;
But i do it in additional data step, i get the right values.&lt;BR /&gt;
Can we not do in single step?</description>
      <pubDate>Fri, 24 Apr 2009 17:16:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Char-to-Numeric-conversion/m-p/23431#M3893</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2009-04-24T17:16:53Z</dc:date>
    </item>
    <item>
      <title>Re: Char to Numeric conversion:</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Char-to-Numeric-conversion/m-p/23432#M3894</link>
      <description>Read about using the OUTPUT statement.  If you include an OUTPUT statement in a DATA step, then the default output at the end of the DATA step is not done.</description>
      <pubDate>Fri, 24 Apr 2009 17:34:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Char-to-Numeric-conversion/m-p/23432#M3894</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2009-04-24T17:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: Char to Numeric conversion:</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Char-to-Numeric-conversion/m-p/23433#M3895</link>
      <description>Also, I believe that your SAS log will reveal the variable value for "str" when your DO / END code is *NOT* executed.  And you are masking the condition by coding the "??" by the way which hinders your ability to debug your program when executed - not a good idea in my experience.&lt;BR /&gt;
&lt;BR /&gt;
And so I suggest you use the following SAS "debugging technique" statement in your program at the "end" of the DATA step and possibly adding it in other places (set the "nnn" value to identify your location in the program when invoked):&lt;BR /&gt;
&lt;BR /&gt;
PUTLOG "&amp;gt;TAGnnn&amp;gt;  I am here!" / _all_;&lt;BR /&gt;
&lt;BR /&gt;
And be sure that you have the maximum amount of SAS Log output generated by your program by coding:&lt;BR /&gt;
&lt;BR /&gt;
OPTIONS SOURCE SOURCE2;&lt;BR /&gt;
* OPTIONS MACROGEN SYMBOLGEN MPRINT; /* uncomment as needed */&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Sat, 25 Apr 2009 17:01:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Char-to-Numeric-conversion/m-p/23433#M3895</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-04-25T17:01:28Z</dc:date>
    </item>
  </channel>
</rss>

