<?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 Referring Variable from SAS fileco in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Referring-Variable-from-SAS-fileco/m-p/217033#M39982</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an Input file which is a SAS Data file (Data is in SAS format).&lt;/P&gt;&lt;P&gt;File variables and date as follows :&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline; font-family: 'courier new', courier;"&gt;Obs&amp;nbsp;&amp;nbsp;&amp;nbsp; ID1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ID2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Cons_Date&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1234&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 45678&amp;nbsp;&amp;nbsp;&amp;nbsp; 06APR2015:00:00:00&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It has a date filed (field name as cons_date) in format DDMMMYYYY:HH:MM:SS (Eg .. 06Apr2015:00:00:00).&lt;/P&gt;&lt;P&gt;I need to find out Month end date from the above field.&lt;/P&gt;&lt;P&gt;Eg .. here the result should come as 30Apr2015.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need assistance in how to refer the variable (cons_date) from SAS Input file.&lt;/P&gt;&lt;P&gt;This could be a simple question but since I am new to SAS I require assistance for this. Can some one pls assist.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Apr 2015 01:43:16 GMT</pubDate>
    <dc:creator>Sreeni</dc:creator>
    <dc:date>2015-04-07T01:43:16Z</dc:date>
    <item>
      <title>Referring Variable from SAS fileco</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Referring-Variable-from-SAS-fileco/m-p/217033#M39982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an Input file which is a SAS Data file (Data is in SAS format).&lt;/P&gt;&lt;P&gt;File variables and date as follows :&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline; font-family: 'courier new', courier;"&gt;Obs&amp;nbsp;&amp;nbsp;&amp;nbsp; ID1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ID2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Cons_Date&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1234&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 45678&amp;nbsp;&amp;nbsp;&amp;nbsp; 06APR2015:00:00:00&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It has a date filed (field name as cons_date) in format DDMMMYYYY:HH:MM:SS (Eg .. 06Apr2015:00:00:00).&lt;/P&gt;&lt;P&gt;I need to find out Month end date from the above field.&lt;/P&gt;&lt;P&gt;Eg .. here the result should come as 30Apr2015.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need assistance in how to refer the variable (cons_date) from SAS Input file.&lt;/P&gt;&lt;P&gt;This could be a simple question but since I am new to SAS I require assistance for this. Can some one pls assist.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2015 01:43:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Referring-Variable-from-SAS-fileco/m-p/217033#M39982</guid>
      <dc:creator>Sreeni</dc:creator>
      <dc:date>2015-04-07T01:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: Referring Variable from SAS fileco</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Referring-Variable-from-SAS-fileco/m-p/217034#M39983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input Obs ID1 ID2 Cons_Date :anydtdtm.;&lt;/P&gt;&lt;P&gt;month_end=intnx('month',datepart(Cons_Date),0,'end'); &lt;/P&gt;&lt;P&gt;format month_end date9.;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1234&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 45678&amp;nbsp;&amp;nbsp;&amp;nbsp; 06APR2015:00:00:00&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;proc print;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2015 03:17:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Referring-Variable-from-SAS-fileco/m-p/217034#M39983</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2015-04-07T03:17:44Z</dc:date>
    </item>
    <item>
      <title>Re: Referring Variable from SAS fileco</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Referring-Variable-from-SAS-fileco/m-p/217035#M39984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This assumes that the variable is numeric with a datetime format applied. If the date is character this answer does not apply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the INTNX() function with a 0 increment and align the date to the end of the month using 'e'.&lt;/P&gt;&lt;P&gt;The DATEPART() function converts the datetime variable to a date variable.&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#p10v3sa3i4kfxfn1sovhi5xzxh8n.htm" title="http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#p10v3sa3i4kfxfn1sovhi5xzxh8n.htm"&gt;SAS(R) 9.3 Functions and CALL Routines: Reference&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;date_want=intnx('month', datepart(cons_date), 0, 'e');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;format date_want date9.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2015 03:20:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Referring-Variable-from-SAS-fileco/m-p/217035#M39984</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-04-07T03:20:02Z</dc:date>
    </item>
  </channel>
</rss>

