<?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 Functions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Put-and-Input-Functions/m-p/399966#M278580</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/118529"&gt;@docctong&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I have a question on what is the purpose of using input and put functions together in the command below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Inc_date=input(put(var14,8.),yymmdd8.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Var14 is in a CSV file that I am importing into SAS.&amp;nbsp; Thanks.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ideally it would be&amp;nbsp;read in correctly in the first place, not converting after, using the informat of yymmdd8 rather than using PROC IMPORT. There are circumstances where this may not be appropriate though.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 30 Sep 2017 02:35:33 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-09-30T02:35:33Z</dc:date>
    <item>
      <title>Put and Input Functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-and-Input-Functions/m-p/399928#M278577</link>
      <description>&lt;P&gt;I have a question on what is the purpose of using input and put functions together in the command below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Inc_date=input(put(var14,8.),yymmdd8.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Var14 is in a CSV file that I am importing into SAS.&amp;nbsp; Thanks.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2017 21:36:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-and-Input-Functions/m-p/399928#M278577</guid>
      <dc:creator>docctong</dc:creator>
      <dc:date>2017-09-29T21:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: Put and Input Functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-and-Input-Functions/m-p/399934#M278578</link>
      <description>&lt;P&gt;The outer function&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; INPUT(x,yymmdd8.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;tells sas to expect X to be a character variable with 8 characters laid out as YYYYMMDD, and by applying the YYMMDD8. informat, to convert it to a date value (i.e. number of days after/before 01jan1960), making INC_DATE a date variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But VAR14 is apparently a numeric, not a character var.&amp;nbsp; It may very well have a numeric value like 20170929, but the INPUT function needs it to be "20170920" to properly convert.&amp;nbsp; Therefore the nested function,&amp;nbsp;PUT(var14,8.), &amp;nbsp;tells sas to "write out" the value of var14 as a character variable length 8.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One could do the equivalent by:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Sasfont"&gt; dat=mdy(mod(int(x/&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Sasfont"&gt;100&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Sasfont"&gt;),&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Sasfont"&gt;100&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Sasfont"&gt;),mod(x,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Sasfont"&gt;100&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Sasfont"&gt;),int(x/&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Sasfont"&gt;10000&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Sasfont"&gt;));&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2017 22:06:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-and-Input-Functions/m-p/399934#M278578</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-09-29T22:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: Put and Input Functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-and-Input-Functions/m-p/399935#M278579</link>
      <description>&lt;P&gt;put() converts a numerical value to a string, which is then converted to a date value with the input() function.&lt;/P&gt;
&lt;P&gt;Probably var14 contains a numerical value like 20170929.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2017 22:09:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-and-Input-Functions/m-p/399935#M278579</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-09-29T22:09:01Z</dc:date>
    </item>
    <item>
      <title>Re: Put and Input Functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-and-Input-Functions/m-p/399966#M278580</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/118529"&gt;@docctong&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I have a question on what is the purpose of using input and put functions together in the command below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Inc_date=input(put(var14,8.),yymmdd8.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Var14 is in a CSV file that I am importing into SAS.&amp;nbsp; Thanks.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ideally it would be&amp;nbsp;read in correctly in the first place, not converting after, using the informat of yymmdd8 rather than using PROC IMPORT. There are circumstances where this may not be appropriate though.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Sep 2017 02:35:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-and-Input-Functions/m-p/399966#M278580</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-30T02:35:33Z</dc:date>
    </item>
  </channel>
</rss>

