<?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 with Computed Columns after changes from numeric format to Date format. in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-with-Computed-Columns-after-changes-from-numeric-format-to/m-p/53821#M5713</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Finally, the solution for the first table was: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"20110607" ==&amp;gt; put(input("20110607,yymmdd8.),ddmmyy10.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the second table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"07/05/2011" ==&amp;gt; put(input("07/05/2011",mmddyy10.).ddmmyy10.);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Sep 2011 12:45:19 GMT</pubDate>
    <dc:creator>_Joe</dc:creator>
    <dc:date>2011-09-06T12:45:19Z</dc:date>
    <item>
      <title>Query with Computed Columns after changes from numeric format to Date format.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-with-Computed-Columns-after-changes-from-numeric-format-to/m-p/53816#M5708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="background-color: #eef4f9;"&gt;&lt;SPAN lang="EN" style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;I'm working with SAS Enterprise Guide I have a data with dates entered in NUMERIC format. I will like to change in into the DATE format (‘DD/MMM/YYYY’). &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #eef4f9;"&gt;&lt;SPAN lang="EN" style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;To do this (Querie Builder &amp;gt; Computed Column); but i don’t know how to do this. Can someone help me?&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #eef4f9;"&gt;&lt;SPAN lang="EN" style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;After that, I have to join data (LEFT JOIN) from 2 tables and realise the query by the date columns&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2011 11:11:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-with-Computed-Columns-after-changes-from-numeric-format-to/m-p/53816#M5708</guid>
      <dc:creator>_Joe</dc:creator>
      <dc:date>2011-08-24T11:11:15Z</dc:date>
    </item>
    <item>
      <title>Query with Computed Columns after changes from numeric format to Date format.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-with-Computed-Columns-after-changes-from-numeric-format-to/m-p/53817#M5709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;With format, do you mean SAS format or data type? (There is no SAS format named NUMERIC).&lt;/P&gt;&lt;P&gt;Please give an example of how your dates are stored. This goes for the date column in the tables you wish to join.&lt;/P&gt;&lt;P&gt;Basically, SAS dates are stored as integers. SAS formats are used to make them dynamically take different views.&lt;/P&gt;&lt;P&gt;So, if your dates are not stored as SAS date integers, you need convert them using the input function.&lt;/P&gt;&lt;P&gt;Then use an appropriate format for the display.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/Linus &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2011 13:37:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-with-Computed-Columns-after-changes-from-numeric-format-to/m-p/53817#M5709</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2011-08-24T13:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: Query with Computed Columns after changes from numeric format to Date format.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-with-Computed-Columns-after-changes-from-numeric-format-to/m-p/53818#M5710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;First step &lt;SPAN style="color: #0070c0;"&gt;import a CSV file to a SAS table&lt;/SPAN&gt;, then the format is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 100%; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Name&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Type&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Long&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Format&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Format L&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Header 6&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Flight_date&lt;/TD&gt;&lt;TD&gt;Number&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;BEST12.0&lt;/TD&gt;&lt;TD&gt;F12.0&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the data is:&lt;/P&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN lang="EN" style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 100%; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Flight_date&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20110607&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20110504&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN lang="EN" style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN lang="EN" style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN lang="EN" style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN lang="EN" style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;I convert them using the input function:&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-family: 'Arial','sans-serif'; color: #0070c0; font-size: 9pt;"&gt;IMPW.flight_date 2=input(IMPW.flight_date,yyyymmdd.10)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But it doesn’t work!!&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Question 1:&lt;/SPAN&gt; I have to create the column IMPW.flight_date2 before to create the input function. But, where do you create the new column?&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Question 2:&lt;/SPAN&gt;&amp;nbsp; Do you know the input function to convert from number to date (ddmmyyyy)?&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;The 2nd table has the next data format: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 100%; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Name&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Type&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Long&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;Format&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Format L&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;fecha_vuelo&lt;/TD&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;DDMMYY10.0&lt;/TD&gt;&lt;TD&gt;F12.0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the data is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 100%; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;fecha_vuelo&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;07/05/2011&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;09/06/2011&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11/06/2011&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2011 15:15:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-with-Computed-Columns-after-changes-from-numeric-format-to/m-p/53818#M5710</guid>
      <dc:creator>_Joe</dc:creator>
      <dc:date>2011-08-24T15:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: Query with Computed Columns after changes from numeric format to Date format.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-with-Computed-Columns-after-changes-from-numeric-format-to/m-p/53819#M5711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think that you are looking for something like the following.&amp;nbsp; Note, in the code, that you can either create a new variable or simply replace the original, as both are numeric variables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input flight_date;&lt;/P&gt;&lt;P&gt;&amp;nbsp; flight_date2=input(put(flight_date,8.),yymmdd8.);&lt;/P&gt;&lt;P&gt;&amp;nbsp; flight_date=input(put(flight_date,8.),yymmdd8.);&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;20110607&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2011 15:25:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-with-Computed-Columns-after-changes-from-numeric-format-to/m-p/53819#M5711</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-08-24T15:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: Query with Computed Columns after changes from numeric format to Date format.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-with-Computed-Columns-after-changes-from-numeric-format-to/m-p/53820#M5712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; A date in SAS is just a number, expressed as the number of days since 01JAN1960.&amp;nbsp; It usually has an associated format for display purposes, so we humans can deduce that 18785 = 20110607.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;So, it's hard for me to understand what you mean by "convert from number to date".&amp;nbsp; By "date" do you mean the numeric representation of a date, i.e. the correct number representing a given date?&amp;nbsp; Or rather the character representation of a SAS date variable, which is just a number?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The input function can be used to convert text input into either numeric or text output.&amp;nbsp; The put function can be used to convert either numeric or text input into text output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To convert the below text to their equivalent dates (untested, see the doc if I've got the formats slightly wrong):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"20110607" ==&amp;gt; input("20110607",yymmdd8.); == 18785&lt;/P&gt;&lt;P&gt;"07/05/2011" ==&amp;gt; input("07/05/2011",mmddyy10.); == 18813&amp;nbsp; (I assume "07/05/2011" is 05JUL2011).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To convert the above dates to their character representation (you seem to prefer the ddmmyy10. format for your dates):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;put(18785,ddmmyy10.) ==&amp;gt; 06/07/2011&lt;/P&gt;&lt;P&gt;put(18813,ddmmyy10.) ==&amp;gt; 07/05/2011&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Putting it all together:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"20110607" ==&amp;gt; put(input("20110607,yymmdd8.),ddmmyy10.);&lt;/P&gt;&lt;P&gt;"07/05/2011" ==&amp;gt; put(input("07/05/2011",mmddyy10.).ddmmyy10.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I recommend you figure out how to import your CSV file with your date columns as text, then using the input function to conver the text to date (numeric) format based on the format of your date text strings in your CSV file.&amp;nbsp; Then, either associate your date variables with your desired date format, or derive another variable containing the text representation of your dates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Sep 2011 05:03:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-with-Computed-Columns-after-changes-from-numeric-format-to/m-p/53820#M5712</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2011-09-05T05:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: Query with Computed Columns after changes from numeric format to Date format.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-with-Computed-Columns-after-changes-from-numeric-format-to/m-p/53821#M5713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Finally, the solution for the first table was: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"20110607" ==&amp;gt; put(input("20110607,yymmdd8.),ddmmyy10.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the second table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"07/05/2011" ==&amp;gt; put(input("07/05/2011",mmddyy10.).ddmmyy10.);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2011 12:45:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Query-with-Computed-Columns-after-changes-from-numeric-format-to/m-p/53821#M5713</guid>
      <dc:creator>_Joe</dc:creator>
      <dc:date>2011-09-06T12:45:19Z</dc:date>
    </item>
  </channel>
</rss>

