<?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: Query builder - Add date value (year) instead of numeric value in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920423#M44496</link>
    <description>&lt;P&gt;Stop referring to formats here. SHOW US what you have at the start and then SHOW US the desired end result.&lt;/P&gt;</description>
    <pubDate>Fri, 15 Mar 2024 13:20:17 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2024-03-15T13:20:17Z</dc:date>
    <item>
      <title>Query builder - Add date value (year) instead of numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920389#M44483</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;In the query builder I added a computed column to add a year (2024) to the data set. But when I run the changes I get the output 1965 instead of 2024.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Computed item:&amp;nbsp;PUT(YEAR(2024), 4.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really need it to be in &lt;STRONG&gt;date format&lt;/STRONG&gt; and not a numeric format that's why I used the calculated item above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What do I have to do differently?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 10:18:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920389#M44483</guid>
      <dc:creator>user34567</dc:creator>
      <dc:date>2024-03-15T10:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: Query builder - Add date value (year) instead of numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920390#M44484</link>
      <description>&lt;P&gt;If you have a variable whose value is the number 2024, you don't need to format it and you don't need to use it inside PUT(). You can simply use the variable which has the value of 2024.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please explain further, show us the inputs and the desired output. What does it mean to "add a year to a data set"? SHOW US.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 10:40:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920390#M44484</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-03-15T10:40:08Z</dc:date>
    </item>
    <item>
      <title>Re: Query builder - Add date value (year) instead of numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920394#M44485</link>
      <description>If you need year as textual just add it as a constant in your expression:&lt;BR /&gt;"2024"</description>
      <pubDate>Fri, 15 Mar 2024 11:24:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920394#M44485</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2024-03-15T11:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: Query builder - Add date value (year) instead of numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920403#M44487</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;, thank you for responding. If I just add "2024" it wel be marked as a numeric value instead of date. In SAS Viya I would like to link the years from two different datasets to eachother but I cannot do that when it is not seen as a real date.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 12:21:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920403#M44487</guid>
      <dc:creator>user34567</dc:creator>
      <dc:date>2024-03-15T12:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: Query builder - Add date value (year) instead of numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920410#M44491</link>
      <description>I'm confused, if I add "2024" in the calculated columns expression, a character variable is created.</description>
      <pubDate>Fri, 15 Mar 2024 12:36:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920410#M44491</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2024-03-15T12:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: Query builder - Add date value (year) instead of numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920418#M44493</link>
      <description>&lt;P&gt;Exactly, but I need it to be a date format YYYY, not numeric&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 12:53:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920418#M44493</guid>
      <dc:creator>user34567</dc:creator>
      <dc:date>2024-03-15T12:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: Query builder - Add date value (year) instead of numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920420#M44495</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/445848"&gt;@user34567&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;, thank you for responding. If I just add "2024" it wel be marked as a numeric value instead of date. In SAS Viya I would like to link the years from two different datasets to eachother but I cannot do that when it is not seen as a real date.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you want to create a DATE value you need to specify the month and the day also.&amp;nbsp; Normally people just use January 1st.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 13:11:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920420#M44495</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-15T13:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: Query builder - Add date value (year) instead of numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920423#M44496</link>
      <description>&lt;P&gt;Stop referring to formats here. SHOW US what you have at the start and then SHOW US the desired end result.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 13:20:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920423#M44496</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-03-15T13:20:17Z</dc:date>
    </item>
    <item>
      <title>Re: Query builder - Add date value (year) instead of numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920435#M44498</link>
      <description>&lt;P&gt;????&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 14:01:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920435#M44498</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2024-03-15T14:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: Query builder - Add date value (year) instead of numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920462#M44499</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/445848"&gt;@user34567&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Exactly, but I need it to be a date format YYYY, not numeric&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;A date in SAS is always numeric (count of days starting at 1960-10-01), which is displayed in human-readable form through a format of the date group.&lt;/P&gt;
&lt;P&gt;The YEAR. format will display only the year part of such a value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, what do you have in both datasets (type and format of the existing variables), and along which value extracted from these do you want to join?&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 14:27:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920462#M44499</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-03-15T14:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: Query builder - Add date value (year) instead of numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920463#M44500</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/445848"&gt;@user34567&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;In the query builder I added a computed column to add a year (2024) to the data set. But when I run the changes I get the output 1965 instead of 2024.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Computed item:&amp;nbsp;PUT(YEAR(2024), 4.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I really need it to be in &lt;STRONG&gt;date format&lt;/STRONG&gt; and not a numeric format that's why I used the calculated item above.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do I have to do differently?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks in advance!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Do not use a calculated item.&lt;/P&gt;
&lt;P&gt;Change the format on the variable to be &lt;STRIKE&gt;YY4.&lt;/STRIKE&gt;&amp;nbsp; YEAR4. instead.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/da/vdmmlcdc/8.1/leforinforref/p0jwqba6i1r0j1n1xe9ovnn0pamr.htm" target="_blank"&gt;https://documentation.sas.com/doc/da/vdmmlcdc/8.1/leforinforref/p0jwqba6i1r0j1n1xe9ovnn0pamr.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 14:47:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920463#M44500</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2024-03-15T14:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: Query builder - Add date value (year) instead of numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920465#M44501</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/445848"&gt;@user34567&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Exactly, but I need it to be a date format YYYY, not numeric&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;A DATE is numeric.&amp;nbsp; But the number 2,024 is a day in July of 1965.&amp;nbsp; So applying the YEAR() function or the YEAR format to the value 2,024 will yield 1965.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assign and actual date to your new variable.&amp;nbsp; Then attach a format, like YEAR4. that just displays the year part of the date value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If VIYA supports SAS date constants use:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;'01JAN2024'd&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Mar 2024 14:55:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920465#M44501</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-15T14:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: Query builder - Add date value (year) instead of numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920650#M44502</link>
      <description>&lt;P&gt;Thank you, this was very helpful! Now I also understand why my 'solution' was not working.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Mar 2024 09:32:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-builder-Add-date-value-year-instead-of-numeric-value/m-p/920650#M44502</guid>
      <dc:creator>user34567</dc:creator>
      <dc:date>2024-03-18T09:32:00Z</dc:date>
    </item>
  </channel>
</rss>

