<?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: best format in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/best-format/m-p/498837#M6281</link>
    <description>Hi:&lt;BR /&gt;  What program have you tried? What happened when you used your INPUT function?&lt;BR /&gt;Cynthia</description>
    <pubDate>Tue, 25 Sep 2018 19:40:33 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2018-09-25T19:40:33Z</dc:date>
    <item>
      <title>best format</title>
      <link>https://communities.sas.com/t5/SAS-Studio/best-format/m-p/498835#M6280</link>
      <description>&lt;P&gt;&lt;SPAN&gt;hi&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;sub &amp;nbsp; var&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;110 new&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;111 1234&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;101&amp;nbsp; char&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;100&amp;nbsp; 321&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;in the above table 'var' being a character variable, pls help me to solve&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;newvar=input(var,best.);?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2018 19:36:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/best-format/m-p/498835#M6280</guid>
      <dc:creator>AKHILA</dc:creator>
      <dc:date>2018-09-25T19:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: best format</title>
      <link>https://communities.sas.com/t5/SAS-Studio/best-format/m-p/498837#M6281</link>
      <description>Hi:&lt;BR /&gt;  What program have you tried? What happened when you used your INPUT function?&lt;BR /&gt;Cynthia</description>
      <pubDate>Tue, 25 Sep 2018 19:40:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/best-format/m-p/498837#M6281</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-09-25T19:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: best format</title>
      <link>https://communities.sas.com/t5/SAS-Studio/best-format/m-p/498838#M6282</link>
      <description>&lt;P&gt;Var must be character because it has mixed types, character and numeric. What do you want to happen with the character values?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise your code looks correct, did it not work when you tried it? If so, show what you tried and the error.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/234880"&gt;@AKHILA&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;hi&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;sub &amp;nbsp; var&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;110 new&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;111 1234&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;101&amp;nbsp; char&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;100&amp;nbsp; 321&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;in the above table 'var' being a character variable, pls help me to solve&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;newvar=input(var,best.);?&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2018 19:40:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/best-format/m-p/498838#M6282</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-25T19:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: best format</title>
      <link>https://communities.sas.com/t5/SAS-Studio/best-format/m-p/498839#M6283</link>
      <description>&lt;P&gt;Do you mean that you have a value that reads "var" or "char" and you want it to become numeric? Since there is no obvious conversion of text "var" or "char" to numeric the value from an input would missing. If you expect a numeric value you will need to provide one elsewhere.&lt;/P&gt;
&lt;P&gt;The values 1234 and 321 should convert without any problem with the code that you show.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2018 19:41:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/best-format/m-p/498839#M6283</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-09-25T19:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: best format</title>
      <link>https://communities.sas.com/t5/SAS-Studio/best-format/m-p/498840#M6284</link>
      <description>&lt;P&gt;I think you are looking to use the ?? modifier&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input sub   var $;
cards;
110 new
111 1234
101  char
100  321
;

data want;
set have;
newvar=input(var,?? best. );
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Sep 2018 19:42:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/best-format/m-p/498840#M6284</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-09-25T19:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: best format</title>
      <link>https://communities.sas.com/t5/SAS-Studio/best-format/m-p/498841#M6285</link>
      <description>&lt;P&gt;FORMATS are used to convert values into strings. The BEST format is for converting numbers into strings that will best fit the width provided.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But your program is trying to use the BEST informat instead of the BEST format.&amp;nbsp; Informats are used to convert strings into values. Numeric informats convert strings into numbers. BEST when used as in INFORMAT is just an alias for the normal numeric informat. There is only one way to store an actual number in SAS. There is no "best" way to store a number.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So your program will convert the strings that look like numbers into those numbers. The other strings, like 'var' will be converted into missing values.&amp;nbsp; It will also write notes to the log when it cannot convert the value.&amp;nbsp; You use the ? or ?? prefix on the informat in your INPUT() function call to suppress the error messages.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2018 19:45:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/best-format/m-p/498841#M6285</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-09-25T19:45:17Z</dc:date>
    </item>
    <item>
      <title>Re: best format</title>
      <link>https://communities.sas.com/t5/SAS-Studio/best-format/m-p/498842#M6286</link>
      <description>&lt;P&gt;this was an interview qstn.they asked me to write the output for this.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2018 19:50:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/best-format/m-p/498842#M6286</guid>
      <dc:creator>AKHILA</dc:creator>
      <dc:date>2018-09-25T19:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: best format</title>
      <link>https://communities.sas.com/t5/SAS-Studio/best-format/m-p/498844#M6287</link>
      <description>&lt;P&gt;&lt;SPAN&gt;this was an interview qstn.they asked me to write the output for this&lt;/SPAN&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2018 19:51:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/best-format/m-p/498844#M6287</guid>
      <dc:creator>AKHILA</dc:creator>
      <dc:date>2018-09-25T19:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: best format</title>
      <link>https://communities.sas.com/t5/SAS-Studio/best-format/m-p/498850#M6288</link>
      <description>&lt;P&gt;I'm guessing they were expecting you to say this would create an error because of&amp;nbsp;ABC Reason and that the way to read it in is to use an IF/THEN, or IFC/IFN statement or suppress the errors in the INPUT(), but that suppressing errors automatically is dangerous because of XYX.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/234880"&gt;@AKHILA&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;this was an interview qstn.they asked me to write the output for this&lt;/SPAN&gt;.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Converting variables between types is a basic task that they would expect an analyst to be familiar with if they state they know SAS.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2018 20:06:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/best-format/m-p/498850#M6288</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-25T20:06:56Z</dc:date>
    </item>
  </channel>
</rss>

