<?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 Sas Convert birthday date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sas-Convert-birthday-date/m-p/756365#M238765</link>
    <description>&lt;P&gt;Hi, Everyone. I want to know how to convert birthday age in the &lt;FONT color="#00FF00"&gt;birth_days&lt;/FONT&gt; column. I have no idea how to type the code for that. Thank you!&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2021-07-23 232852.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/61667iAA28A244721A4FCA/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2021-07-23 232852.png" alt="Screenshot 2021-07-23 232852.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 24 Jul 2021 03:46:09 GMT</pubDate>
    <dc:creator>TRESSQ</dc:creator>
    <dc:date>2021-07-24T03:46:09Z</dc:date>
    <item>
      <title>Sas Convert birthday date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-Convert-birthday-date/m-p/756365#M238765</link>
      <description>&lt;P&gt;Hi, Everyone. I want to know how to convert birthday age in the &lt;FONT color="#00FF00"&gt;birth_days&lt;/FONT&gt; column. I have no idea how to type the code for that. Thank you!&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2021-07-23 232852.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/61667iAA28A244721A4FCA/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2021-07-23 232852.png" alt="Screenshot 2021-07-23 232852.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Jul 2021 03:46:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-Convert-birthday-date/m-p/756365#M238765</guid>
      <dc:creator>TRESSQ</dc:creator>
      <dc:date>2021-07-24T03:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: Sas Convert birthday date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-Convert-birthday-date/m-p/756369#M238768</link>
      <description>&lt;P&gt;Well, you really don't to convert.&amp;nbsp; The best way to store dates is as a number, just as you already have.&amp;nbsp; Then, if you need to have a character date in human readable form, you just apply a Format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's an example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA	Have;
	FORMAT	Birth_Days	YYMMDDD10.;
	INFILE	DATALINES	MISSOVER;
	INPUT	Birth_Days;
DATALINES;
-12005
-21474
-19110
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here's what it looks like in my Output Data window:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jimbarbour_0-1627100728088.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/61668i040C624B36730C43/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jimbarbour_0-1627100728088.png" alt="jimbarbour_0-1627100728088.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I actually haven't changed the values.&amp;nbsp; They're still a number.&amp;nbsp; What I've done is apply a Format so I can read them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I truly need the dates in a character variable (maybe to show on a report), I can, again, apply a format, something like this:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Report_Date = PUT(birth_days, YYMMDDD10.);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Report_Date will be a character date, for example 2021-07-23.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Sat, 24 Jul 2021 04:30:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-Convert-birthday-date/m-p/756369#M238768</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-07-24T04:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: Sas Convert birthday date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-Convert-birthday-date/m-p/756371#M238770</link>
      <description>&lt;P&gt;Thank you so much! Jim. I was wondering if I want to show all the character date in human-readable form,&amp;nbsp; should I copy all the data from birth_days colunm in the code and run it?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA Have;
FORMAT Birth_Days YYMMDDD10.;
INFILE DATALINES MISSOVER;
INPUT Birth_Days;
DATALINES;
-12005
-21474
-19110

-15519

-22464

(and so on, copy all the data inside here)
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 24 Jul 2021 04:51:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-Convert-birthday-date/m-p/756371#M238770</guid>
      <dc:creator>TRESSQ</dc:creator>
      <dc:date>2021-07-24T04:51:06Z</dc:date>
    </item>
    <item>
      <title>Re: Sas Convert birthday date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-Convert-birthday-date/m-p/756375#M238773</link>
      <description>&lt;P&gt;Well, if you already have a SAS dataset, you could just apply a Format, and in the Data window, you'd have everything in machine readable format.&amp;nbsp; No need to type in all the dates if they're already in a SAS dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC	DATASETS	LIBRARY=WORK	NOLIST;
	MODIFY	HAVE;
		FORMAT	Birth_Days	DATE9.;
QUIT;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You'd have to change the Library from WORK to whatever Library it is that you're using, and you'd have to change the dataset name I'm using, Have, to whatever the name of the dataset that your using is.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Sat, 24 Jul 2021 05:07:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-Convert-birthday-date/m-p/756375#M238773</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-07-24T05:07:39Z</dc:date>
    </item>
    <item>
      <title>Re: Sas Convert birthday date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-Convert-birthday-date/m-p/756376#M238774</link>
      <description>&lt;P&gt;DATALINES allows placing of input data inline in the code, it is mostly used to create small datasets for demonstration purposes or, say, CNTLIN datasets for PROC FORMAT.&lt;/P&gt;
&lt;P&gt;When posting questions, always use the datalines method, as it enables us to quickly replicate your dataset with just copy/paste and submit. Posting a picture is the worst way of presenting data, as it does not tell us anything about variable attributes, and forces us to tediously type stuff off the screen, with ample opportunity for mistakes.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Jul 2021 05:26:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-Convert-birthday-date/m-p/756376#M238774</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-07-24T05:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: Sas Convert birthday date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-Convert-birthday-date/m-p/756377#M238775</link>
      <description>&lt;P&gt;Alright. One more question, I was thinking if I want to divide 365 by each data(ex: -12005/365 days), what kind of code should I search in Google?I thought that it was a good way to know their age. Appericate it! Jim&lt;/P&gt;</description>
      <pubDate>Sat, 24 Jul 2021 05:33:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-Convert-birthday-date/m-p/756377#M238775</guid>
      <dc:creator>TRESSQ</dc:creator>
      <dc:date>2021-07-24T05:33:09Z</dc:date>
    </item>
    <item>
      <title>Re: Sas Convert birthday date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-Convert-birthday-date/m-p/756379#M238777</link>
      <description>&lt;P&gt;Hmmm.&amp;nbsp; I'm not sure that will give you what you need.&amp;nbsp; Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;    today = DATE();
    days = today - birth_days;
    age = floor(days / 365); &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Jul 2021 05:50:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-Convert-birthday-date/m-p/756379#M238777</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-07-24T05:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: Sas Convert birthday date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-Convert-birthday-date/m-p/756382#M238780</link>
      <description>&lt;P&gt;Maxim 9: There Is a Function for It.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/lefunctionsref/p1pmmr2dtec32an1vbsqmm3abil5.htm" target="_blank" rel="noopener"&gt;YRDIF Function&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Jul 2021 06:04:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-Convert-birthday-date/m-p/756382#M238780</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-07-24T06:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: Sas Convert birthday date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-Convert-birthday-date/m-p/756450#M238826</link>
      <description>&lt;P&gt;Ok I will try it later tho. Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 25 Jul 2021 04:16:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-Convert-birthday-date/m-p/756450#M238826</guid>
      <dc:creator>TRESSQ</dc:creator>
      <dc:date>2021-07-25T04:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Sas Convert birthday date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-Convert-birthday-date/m-p/756451#M238827</link>
      <description>&lt;P&gt;Thank you so much. I will check it. Appreciate it.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Jul 2021 04:17:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-Convert-birthday-date/m-p/756451#M238827</guid>
      <dc:creator>TRESSQ</dc:creator>
      <dc:date>2021-07-25T04:17:09Z</dc:date>
    </item>
  </channel>
</rss>

