<?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 BEST12 to year in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808426#M33676</link>
    <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cooksam13_0-1650315270171.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/70551iE7B8A2BDAED58FB2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cooksam13_0-1650315270171.png" alt="Cooksam13_0-1650315270171.png" /&gt;&lt;/span&gt;&amp;nbsp;i need to convert it to year. format so i can use it to find an age in a later step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Apr 2022 20:55:49 GMT</pubDate>
    <dc:creator>Cooksam13</dc:creator>
    <dc:date>2022-04-18T20:55:49Z</dc:date>
    <item>
      <title>convert BEST12 to year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808422#M33674</link>
      <description>&lt;P&gt;Hiyya,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cannot for the life of me figure out how to convert this data to year format&lt;/P&gt;&lt;P&gt;Dt.Birth is in format Best12, and I want to change it to year format&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have tried several different ways but it isn't working,&lt;/P&gt;&lt;P&gt;this is what I have now and then all the data gets set to 1965 which is not correct.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data work.NCdate;&lt;BR /&gt;set new.step2;&lt;BR /&gt;Dt_b=input(input(Dt_birth, best.), year.);&lt;BR /&gt;format Dt_b year.;&lt;BR /&gt;run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2022 20:44:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808422#M33674</guid>
      <dc:creator>Cooksam13</dc:creator>
      <dc:date>2022-04-18T20:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: convert BEST12 to year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808424#M33675</link>
      <description>&lt;P&gt;Dt_birth is best12. — okay. What does it look like when you see it? Show us a typical example(s) of this variable's value.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2022 20:52:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808424#M33675</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-18T20:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: convert BEST12 to year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808426#M33676</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cooksam13_0-1650315270171.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/70551iE7B8A2BDAED58FB2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cooksam13_0-1650315270171.png" alt="Cooksam13_0-1650315270171.png" /&gt;&lt;/span&gt;&amp;nbsp;i need to convert it to year. format so i can use it to find an age in a later step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2022 20:55:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808426#M33676</guid>
      <dc:creator>Cooksam13</dc:creator>
      <dc:date>2022-04-18T20:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: convert BEST12 to year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808427#M33677</link>
      <description>&lt;P&gt;Now I'm lost.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You want to convert DT_BIRTH which has a value of 1994 to a year? It is a year, isn't it?&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2022 20:55:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808427#M33677</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-18T20:55:39Z</dc:date>
    </item>
    <item>
      <title>Re: convert BEST12 to year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808428#M33678</link>
      <description>&lt;P&gt;the format for Dt_birth is in best12 and I need to convert it to year. format to use it to find age in a later step&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2022 20:57:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808428#M33678</guid>
      <dc:creator>Cooksam13</dc:creator>
      <dc:date>2022-04-18T20:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: convert BEST12 to year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808431#M33679</link>
      <description>&lt;P&gt;You want to format 1994 to be the year 1994 for later use? As far as I can see, you can use it as is, without any additional formatting or conversion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What later use? Please be specific and detailed.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2022 21:00:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808431#M33679</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-18T21:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: convert BEST12 to year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808432#M33680</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/347594"&gt;@Cooksam13&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;the format for Dt_birth is in best12 and I need to convert it to year. format to use it to find age in a later step&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;To calculate age based on date of birth and a calendar date, assuming that is your goal, you need a day of month, month of year and a year value to create a date value if you want to use any of the date formats or functions.&lt;/P&gt;
&lt;P&gt;For instance to make a value of 15 Jun 2020, the 15th day of the 6th month in 2020:&lt;/P&gt;
&lt;PRE&gt;data example;
   date = mdy(6,15,2020);
   format date date9.;
run;&lt;/PRE&gt;
&lt;P&gt;If you want to use just a year, what day and month do you want to use? Or show a complete working example.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2022 22:40:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808432#M33680</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-04-18T22:40:27Z</dc:date>
    </item>
    <item>
      <title>Re: convert BEST12 to year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808433#M33681</link>
      <description>&lt;P&gt;I think&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/347594"&gt;@Cooksam13&lt;/a&gt;&amp;nbsp;wants to convert the variable to SAS-Date.&amp;nbsp; Is there a year INFORMAT?&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2022 21:04:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808433#M33681</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2022-04-18T21:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: convert BEST12 to year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808445#M33682</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410"&gt;@data_null__&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I think&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/347594"&gt;@Cooksam13&lt;/a&gt;&amp;nbsp;wants to convert the variable to SAS-Date.&amp;nbsp; Is there a year INFORMAT?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I think the MDY function would work. But &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/347594"&gt;@Cooksam13&lt;/a&gt; didn't say that's what he wanted, maybe its what he wants. But he could simply use the variable as is too.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2022 22:03:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808445#M33682</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-18T22:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: convert BEST12 to year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808458#M33683</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/347594"&gt;@Cooksam13&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I agree with what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;has said. You should be able to use the year value as it is.&lt;BR /&gt;Needless to say that SAS stores dates as numbers (number of days since 01Jan1960). The formats are just visual representations. Internally the date values continue to be in numbers regardless of the format you are using.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2022 23:37:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808458#M33683</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2022-04-18T23:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: convert BEST12 to year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808462#M33684</link>
      <description>&lt;P&gt;First the YEAR. format can not be used as an INFORMAT, which is what you are apparently trying to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The YEAR. format will take a sas date-value (i.e.&amp;nbsp;the actual number of days after 01jan1960 - or number of days before when the value is negative).&amp;nbsp; &amp;nbsp;But thhe number 1994, when used as a sas date value would be interpreted as 17jun1965.&amp;nbsp; And if you applied the format (not informat) YEAR., it would be displayed as 1965.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, if you have the value 1994, and for some reason you want to convert it to a sas date value where 1994 is the year in question, you have to choose among 365 possible date values, namely 01jan1994 through 31dec1994.&amp;nbsp; To do that you might use a statement like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Dt_b=mdy(1,1,dt_birth);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which takes the value 1994 and assigns it the numerical value representing 01jan1994.&amp;nbsp; Only then can you appropriately apply the &lt;EM&gt;&lt;STRONG&gt;YEAR.&lt;/STRONG&gt;&lt;/EM&gt; format to the variable &lt;EM&gt;&lt;STRONG&gt;dt_b&lt;/STRONG&gt;&lt;/EM&gt;, which will display the value 1994, even though the underlying number is 12419&amp;nbsp; (01jan1994 is 12,419 days after 01jan1960).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In summary two errors:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;YEAR. is a &lt;STRONG&gt;format&lt;/STRONG&gt;&amp;nbsp;(useful in a PUT statement of PUT function) not an &lt;STRONG&gt;informat&lt;/STRONG&gt; (used in INPUT function or statement).&lt;/LI&gt;
&lt;LI&gt;To convert it to a sas date value (which is required if you intend to use a date-related format), you have to supply a month and day-of-month in addition to the year value that you already have in hand.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Tue, 19 Apr 2022 00:39:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808462#M33684</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2022-04-19T00:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: convert BEST12 to year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808510#M33702</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/131732"&gt;@Sajid01&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/347594"&gt;@Cooksam13&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I agree with what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;has said. You should be able to use the year value as it is.&lt;BR /&gt;Needless to say that SAS stores dates as numbers (number of days since 01Jan1960). The formats are just visual representations. Internally the date values continue to be in numbers regardless of the format you are using.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes, that last sentence is a great point. It doesn't matter* what format you wind up using (or even if you use no format), any future arithmetic or logical operations will be done on the un-formatted value. Changing the value of the variable (so that it is now a true SAS date value, as suggested above) is not a FORMAT issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* — okay the format matters if you are going to put the value in titles, labels or file names, or have to put it into a database that requires a specific format.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 10:09:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/convert-BEST12-to-year/m-p/808510#M33702</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-19T10:09:54Z</dc:date>
    </item>
  </channel>
</rss>

