<?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: PUT and INPUT in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PUT-and-INPUT/m-p/345076#M273086</link>
    <description>&lt;P&gt;Birth date is already a SAS date.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Insread of PUT/INPUT apply a FORMAT statememt.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Format birth_date DATE9.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;. This section of the SAS documentation covers SAS dates quite thoroughly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/basess/68381/HTML/default/viewer.htm#p1638plsagruv4n1biakcm4c8hcs.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/basess/68381/HTML/default/viewer.htm#p1638plsagruv4n1biakcm4c8hcs.htm&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Mar 2017 16:49:40 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-03-28T16:49:40Z</dc:date>
    <item>
      <title>PUT and INPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PUT-and-INPUT/m-p/345068#M273084</link>
      <description>&lt;P&gt;Hi All.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to SAS and started exploring.&lt;/P&gt;&lt;P&gt;I am bit confused with using PUT and INPUT, please help me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a column named Birth_date of type numeric and length 8 Format and Informat MMDDYY10.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;Q1.I am running the below code snippets to get the b_date from Birth_Date&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;data birth;&lt;/DIV&gt;&lt;DIV&gt;set credit card;&lt;/DIV&gt;&lt;DIV&gt;b_date= input(Birth_Date,10.);&lt;/DIV&gt;&lt;DIV&gt;format b_date date9.&lt;/DIV&gt;&lt;DIV&gt;run;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Why for Birth_Date 01/08/1966, b_date = 22JAN1960 ?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Q2. Running the below code Snippets.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;data birth;&lt;/DIV&gt;&lt;DIV&gt;set credit card;&lt;/DIV&gt;&lt;DIV&gt;b_date= input(Birth_Date,10.);&lt;/DIV&gt;&lt;DIV&gt;run:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Why for Birth_Date 01/08/1966, &amp;nbsp;b_date = 21?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Q3)&amp;nbsp;&lt;SPAN&gt;Running the below code Snippets.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;data birth;&lt;/DIV&gt;&lt;DIV&gt;set credit card;&lt;/DIV&gt;&lt;DIV&gt;b_date= put(Birth_Date,10.);&lt;/DIV&gt;&lt;DIV&gt;run:&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Why for Birth_Date 01/08/1966, &amp;nbsp;b_date = 2199?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 28 Mar 2017 16:44:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PUT-and-INPUT/m-p/345068#M273084</guid>
      <dc:creator>vishyy</dc:creator>
      <dc:date>2017-03-28T16:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: PUT and INPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PUT-and-INPUT/m-p/345073#M273085</link>
      <description>&lt;P&gt;Super User&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19750"&gt;@MichelleHomes&lt;/a&gt;&amp;nbsp;has shared a &lt;A href="http://blogs.sas.com/content/sastraining/2013/02/26/rhymes-mnemonics-and-tips-in-learning-sas/" target="_self"&gt;really useful blog post about PUT and INPUT and how to remember the difference.&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2017 16:47:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PUT-and-INPUT/m-p/345073#M273085</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2017-03-28T16:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: PUT and INPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PUT-and-INPUT/m-p/345076#M273086</link>
      <description>&lt;P&gt;Birth date is already a SAS date.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Insread of PUT/INPUT apply a FORMAT statememt.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Format birth_date DATE9.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;. This section of the SAS documentation covers SAS dates quite thoroughly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/basess/68381/HTML/default/viewer.htm#p1638plsagruv4n1biakcm4c8hcs.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/basess/68381/HTML/default/viewer.htm#p1638plsagruv4n1biakcm4c8hcs.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2017 16:49:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PUT-and-INPUT/m-p/345076#M273086</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-03-28T16:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: PUT and INPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PUT-and-INPUT/m-p/345080#M273087</link>
      <description>&lt;P&gt;To answer the "why" questions, you have to begin by understanding how SAS stores dates.&amp;nbsp; That number (2199) means that January 8, 1966 falls 2199 days after January 1, 1960.&amp;nbsp; That's how SAS expects to store dates, and why Reeza's reply will give you part of the answer to your questions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The other part of the "why" questions concerns the INPUT function.&amp;nbsp; INPUT expects to see a character string as the first argument, and reads that character string using the instructions within the second argument.&amp;nbsp; Here, you are passing a number as the first argument.&amp;nbsp; That forces SAS to perform a numeric-to-character conversion to be able to apply the INPUT function.&amp;nbsp; (You might have noticed a message about conversion in the log.)&amp;nbsp; And when SAS performs a numeric-to-character conversion, the usual method it applies is to use a 12-character field, right-hand justified.&amp;nbsp; So the INPUT function is actually reading 8 blanks, followed by "2199".&amp;nbsp; If you apply instructions that tell the INPUT function to read only 10 characters, it finds 8 blanks plus "21".&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2017 17:01:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PUT-and-INPUT/m-p/345080#M273087</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-03-28T17:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: PUT and INPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PUT-and-INPUT/m-p/345391#M273088</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for replying, it really helps me a lot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please explain the below statement, i could not able to get this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"&lt;SPAN&gt;And when SAS performs a numeric-to-character conversion, the usual method it applies is to use a 12-character field, right-hand justified.&amp;nbsp; So the INPUT function is actually reading 8 blanks, followed by "2199".&amp;nbsp; If you apply instructions that tell the INPUT function to read only 10 characters, it finds 8 blanks plus "21&lt;/SPAN&gt;".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&amp;nbsp;&lt;/P&gt;&lt;P&gt;Vishyy&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 14:31:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PUT-and-INPUT/m-p/345391#M273088</guid>
      <dc:creator>vishyy</dc:creator>
      <dc:date>2017-03-29T14:31:03Z</dc:date>
    </item>
    <item>
      <title>Re: PUT and INPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PUT-and-INPUT/m-p/345430#M273089</link>
      <description>&lt;P&gt;When SAS is instructed to perform an operation on a character string, but the value fed to that operation is numeric, SAS has to perform a numeric-to-character conversion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Most of the time, SAS generates a 12-character-long string.&amp;nbsp; So if the numeric value coming in is 3.14, SAS converts this to 8 blanks, followed by the characters "3.14".&amp;nbsp; The conversion process right-hand justifies the original numeric value within the 12-character-long string.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 15:52:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PUT-and-INPUT/m-p/345430#M273089</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-03-29T15:52:27Z</dc:date>
    </item>
  </channel>
</rss>

