<?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: Convert a variable length character to numeric while enforcing fix output length in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-a-variable-length-character-to-numeric-while-enforcing/m-p/499234#M132802</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it does convert it to numeric.&lt;/P&gt;
&lt;P&gt;but&amp;nbsp;doesn't&amp;nbsp;&amp;nbsp;hold the length as requested.&lt;/P&gt;
&lt;P&gt;I am even have a put statement like this (to indicate where the variable ends)&lt;/P&gt;
&lt;P&gt;put 'varx is ' varx ' end';&lt;/P&gt;
&lt;P&gt;and it is written as&lt;/P&gt;
&lt;P&gt;varx is 100 end&lt;/P&gt;
&lt;P&gt;varx is 8 end&lt;/P&gt;
&lt;P&gt;etc.&lt;/P&gt;
&lt;P&gt;so. no sign of even the length of twelve being taken.&lt;/P&gt;
&lt;P&gt;The output file looks fine, though. with the correct length ... but with leading blanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for following up, Kurt.&lt;/P&gt;</description>
    <pubDate>Wed, 26 Sep 2018 19:46:27 GMT</pubDate>
    <dc:creator>shikoulitz</dc:creator>
    <dc:date>2018-09-26T19:46:27Z</dc:date>
    <item>
      <title>Convert a variable length character to numeric while enforcing fix output length</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-a-variable-length-character-to-numeric-while-enforcing/m-p/499227#M132797</link>
      <description>&lt;P&gt;hello guys,&lt;/P&gt;
&lt;P&gt;I have a variable-length variable and need to convert it to numeric while enforcing a fix-length (12 digits) variable.&lt;/P&gt;
&lt;P&gt;I haven't been able to accomplish it.&lt;/P&gt;
&lt;P&gt;I am converting it to numeric.... but with leading spaces&lt;/P&gt;
&lt;P&gt;how can I have leading zeroes instead of spaces before significant digits?&lt;/P&gt;
&lt;P&gt;I have tried several including:&lt;/P&gt;
&lt;P&gt;Format&amp;nbsp;varx z12.;&lt;/P&gt;
&lt;P&gt;varx = input(vary,12.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;varx = put(input(vary,12.),z12);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or at the end&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;varx = varx * 1;&lt;/P&gt;
&lt;P&gt;still I am getting leading spaces.&lt;/P&gt;
&lt;P&gt;How can I fix it to leading zeroes? Need it for another language.&lt;/P&gt;
&lt;P&gt;Thank you so much&lt;/P&gt;</description>
      <pubDate>Wed, 26 Sep 2018 19:23:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-a-variable-length-character-to-numeric-while-enforcing/m-p/499227#M132797</guid>
      <dc:creator>shikoulitz</dc:creator>
      <dc:date>2018-09-26T19:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: Convert a variable length character to numeric while enforcing fix output length</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-a-variable-length-character-to-numeric-while-enforcing/m-p/499231#M132800</link>
      <description>&lt;P&gt;The first method should work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Format varx z12.;
varx = input(vary,12.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What does the log say? And which values do you have in vary?&lt;/P&gt;</description>
      <pubDate>Wed, 26 Sep 2018 19:36:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-a-variable-length-character-to-numeric-while-enforcing/m-p/499231#M132800</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-09-26T19:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: Convert a variable length character to numeric while enforcing fix output length</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-a-variable-length-character-to-numeric-while-enforcing/m-p/499232#M132801</link>
      <description>&lt;P&gt;You missed the dot in the format z12. :&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;varx = put(input(vary,12.),z12.);&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In this case varx should be defined as char type: $12&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Sep 2018 19:42:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-a-variable-length-character-to-numeric-while-enforcing/m-p/499232#M132801</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-09-26T19:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: Convert a variable length character to numeric while enforcing fix output length</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-a-variable-length-character-to-numeric-while-enforcing/m-p/499234#M132802</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it does convert it to numeric.&lt;/P&gt;
&lt;P&gt;but&amp;nbsp;doesn't&amp;nbsp;&amp;nbsp;hold the length as requested.&lt;/P&gt;
&lt;P&gt;I am even have a put statement like this (to indicate where the variable ends)&lt;/P&gt;
&lt;P&gt;put 'varx is ' varx ' end';&lt;/P&gt;
&lt;P&gt;and it is written as&lt;/P&gt;
&lt;P&gt;varx is 100 end&lt;/P&gt;
&lt;P&gt;varx is 8 end&lt;/P&gt;
&lt;P&gt;etc.&lt;/P&gt;
&lt;P&gt;so. no sign of even the length of twelve being taken.&lt;/P&gt;
&lt;P&gt;The output file looks fine, though. with the correct length ... but with leading blanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for following up, Kurt.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Sep 2018 19:46:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-a-variable-length-character-to-numeric-while-enforcing/m-p/499234#M132802</guid>
      <dc:creator>shikoulitz</dc:creator>
      <dc:date>2018-09-26T19:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: Convert a variable length character to numeric while enforcing fix output length</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-a-variable-length-character-to-numeric-while-enforcing/m-p/499238#M132804</link>
      <description>&lt;P&gt;Please supply example data (a dataset with vary as in your original dataset, in a data step with datalines).&lt;/P&gt;</description>
      <pubDate>Wed, 26 Sep 2018 19:51:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-a-variable-length-character-to-numeric-while-enforcing/m-p/499238#M132804</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-09-26T19:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: Convert a variable length character to numeric while enforcing fix output length</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-a-variable-length-character-to-numeric-while-enforcing/m-p/499242#M132807</link>
      <description>&lt;P&gt;not sure what I missed, but you are correct.&lt;/P&gt;
&lt;P&gt;it is working now.&lt;/P&gt;
&lt;P&gt;thanks a lot!!!&lt;/P&gt;</description>
      <pubDate>Wed, 26 Sep 2018 20:00:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-a-variable-length-character-to-numeric-while-enforcing/m-p/499242#M132807</guid>
      <dc:creator>shikoulitz</dc:creator>
      <dc:date>2018-09-26T20:00:11Z</dc:date>
    </item>
  </channel>
</rss>

