<?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: Coding logic in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/700091#M214220</link>
    <description>Hi thanks for the code,based on that 6months i need to extract the data from seperate tables the table names contain month names,can we do that automatically in the same step,extracting the data month wise for the terminals</description>
    <pubDate>Thu, 19 Nov 2020 04:17:10 GMT</pubDate>
    <dc:creator>molla</dc:creator>
    <dc:date>2020-11-19T04:17:10Z</dc:date>
    <item>
      <title>Coding logic</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/699918#M214126</link>
      <description>Hi All,&lt;BR /&gt;I need to develop a logic, scenario given below:&lt;BR /&gt;I need to get the data of terminals after they have installed of first 6months&lt;BR /&gt;Example: If a terminal is installed in apr2020 they i need to get the data of Apr May Jun jully aug sep.similarly if terminal is installed in may i need to get data of May Jun jully aug sep oct.this data has to be picked automatically based on terminal installation month.&lt;BR /&gt;&lt;BR /&gt;Kindly help me with the logic&lt;BR /&gt;</description>
      <pubDate>Wed, 18 Nov 2020 17:56:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/699918#M214126</guid>
      <dc:creator>molla</dc:creator>
      <dc:date>2020-11-18T17:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: Coding logic</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/699919#M214127</link>
      <description>&lt;P&gt;Can you provide some sample of your data? Makes it easier to provide usable code&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 18:00:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/699919#M214127</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-11-18T18:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: Coding logic</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/699921#M214129</link>
      <description>Depends on how your data is structured. If all your data for a terminal is in a single row then it's different than if you have multiple rows for each terminal. &lt;BR /&gt;&lt;BR /&gt;INTNX() is a function you'll likely need. It will increment a date forward or backwards by a specified interval. &lt;BR /&gt;&lt;BR /&gt;So you can find the end window via : &lt;BR /&gt;&lt;BR /&gt;Install6Months =  intnx('month', installDate, 6, 's') ;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 18 Nov 2020 18:06:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/699921#M214129</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-11-18T18:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: Coding logic</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/699923#M214130</link>
      <description>By using intnx function i can get the 6 mnth but how can i get data of first month to sixth month by using this 2 months</description>
      <pubDate>Wed, 18 Nov 2020 18:13:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/699923#M214130</guid>
      <dc:creator>molla</dc:creator>
      <dc:date>2020-11-18T18:13:25Z</dc:date>
    </item>
    <item>
      <title>Re: Coding logic</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/699933#M214135</link>
      <description>If date&amp;gt;=first_month and date&amp;lt;=sixth_month then output ;</description>
      <pubDate>Wed, 18 Nov 2020 18:26:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/699933#M214135</guid>
      <dc:creator>AMSAS</dc:creator>
      <dc:date>2020-11-18T18:26:06Z</dc:date>
    </item>
    <item>
      <title>Re: Coding logic</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/699938#M214140</link>
      <description>&lt;P&gt;It's always best if you can supply date both before and after the transformation you require, and details of what business logic gets you from one to the other.&amp;nbsp; Assuming that you either ant 6 rows or 6 columns for each Terminal Installation, then this code should give you a solution that you can tune to meet your requirements&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample ; 
   infile datalines truncover ; 
   input firstInstall date9. ;
   format firstInstall date9. ;
datalines ;
05May2020
31Jul2020
; run ;
data long_Results ;
   set sample ; 
   do i = 1 to 6 ;
      month = intnx('month',firstinstall,i-1) ;
      output ; 
   end ;
   format month date9. ;
   drop i ;
run ;
data wide_Results ;
   set sample ; 
   array months[6] ;
   do i = 1 to dim(months) ;
      months[i] = intnx('month',firstinstall,i-1) ;
   end ;
   format months1-months6 date9. ;
   drop i ;
run ;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Nov 2020 18:33:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/699938#M214140</guid>
      <dc:creator>MarkDawson</dc:creator>
      <dc:date>2020-11-18T18:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: Coding logic</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/700091#M214220</link>
      <description>Hi thanks for the code,based on that 6months i need to extract the data from seperate tables the table names contain month names,can we do that automatically in the same step,extracting the data month wise for the terminals</description>
      <pubDate>Thu, 19 Nov 2020 04:17:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/700091#M214220</guid>
      <dc:creator>molla</dc:creator>
      <dc:date>2020-11-19T04:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: Coding logic</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/700105#M214227</link>
      <description>In other tables I have the volume of those installed terminals seperately,From Apr 2020 to Nov 2020 I have volumes ,but I need to get the volume for only six months for the months which we have populated,&lt;BR /&gt;</description>
      <pubDate>Thu, 19 Nov 2020 06:01:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/700105#M214227</guid>
      <dc:creator>molla</dc:creator>
      <dc:date>2020-11-19T06:01:56Z</dc:date>
    </item>
    <item>
      <title>Re: Coding logic</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/700140#M214245</link>
      <description>&lt;P&gt;I'm not sure what you mean - please could you give examples of the input table(s), and expected output table(s) results&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 08:47:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/700140#M214245</guid>
      <dc:creator>MarkDawson</dc:creator>
      <dc:date>2020-11-19T08:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: Coding logic</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/700142#M214246</link>
      <description>I have populated the table based on your above code,&lt;BR /&gt;Installedtid mnth1 mnth2 mnth3 mnth4 mnth5 mnth6&lt;BR /&gt;Other tables I have installedtid and mnth1 vol similarly in other tables as well,&lt;BR /&gt;Now I need to get output table with installedtid mnth1volume mnth2volume mnth3volume mnth4volume mnth5vilume mnth6volume,&lt;BR /&gt;Even I have volumes of all months in the tables I need to get the volumes of 6mnths only which I have populated months</description>
      <pubDate>Thu, 19 Nov 2020 09:00:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/700142#M214246</guid>
      <dc:creator>molla</dc:creator>
      <dc:date>2020-11-19T09:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: Coding logic</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/700143#M214247</link>
      <description>&lt;P&gt;I fear we still do not have a good clue about your data structure and contents.&lt;/P&gt;
&lt;P&gt;Please supply data. Don't talk about it, don't try to describe it, show it.&lt;/P&gt;
&lt;P&gt;Use a data step with datalines (or any other means, like loops) that creates a dataset we can use for developing and testing, like Novinosrin showed you&amp;nbsp;&lt;A href="https://communities.sas.com/t5/New-SAS-User/Base-sas-coding/m-p/524111/highlight/true#M4754" target="_blank" rel="noopener"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Then show the expected output from that particular dataset.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 09:13:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/700143#M214247</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-19T09:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: Coding logic</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/700145#M214249</link>
      <description>Table1&lt;BR /&gt;Id mnth1 mnth2 mnth3 mnth4 mnth5 mnth6&lt;BR /&gt;1. Apr20 may20 jun20 jul20 aug20 sep20&lt;BR /&gt;&lt;BR /&gt;Table2&lt;BR /&gt;Id mnth vol&lt;BR /&gt;1 apr20 12&lt;BR /&gt;Table3&lt;BR /&gt;Id mnth vol&lt;BR /&gt;1 may20 15&lt;BR /&gt;Similar for other mnths also I have data&lt;BR /&gt;&lt;BR /&gt;Output dataset&lt;BR /&gt;Id Apr May Jun jul aug sep&lt;BR /&gt;1. 12 15 ....&lt;BR /&gt;If terminal is installed in may then i should get the vol from may Oct</description>
      <pubDate>Thu, 19 Nov 2020 09:27:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/700145#M214249</guid>
      <dc:creator>molla</dc:creator>
      <dc:date>2020-11-19T09:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: Coding logic</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/700148#M214252</link>
      <description>&lt;P&gt;If your data really looks like that ("dates" as strings, wide layout), you suffer from useless data in a useless structure.&lt;/P&gt;
&lt;P&gt;See this short example for intelligent data making the code simple:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data table1;
input id monthcount mnth :yymmn6.;
format date yymmd7.;
datalines;
1 1 202004
1 2 202005
1 3 202006
1 4 202007
1 5 202008
1 6 202009
;

data m1;
input id mnth :yymmn6. volume;
format mnth yymmd7.;
datalines;
1 202004 12
;

data m3;
input id mnth :yymmn6. volume;
format mnth yymmd7.;
datalines;
1 202005 15
;

data all / view=all;
set m:;
run;

data want;
merge
  table1
  all
;
by id mnth;
run;

proc report data=want;
column id mnth,volume;
define id / group;
define mnth / "Volume" across;
define volume / "" analysis sum;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To show you how to make intelligent data out of what you have, supply it in &lt;STRONG&gt;DATA STEPS WITH DATALINES&lt;/STRONG&gt;, as I'm not into the guessing game.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 09:48:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Coding-logic/m-p/700148#M214252</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-19T09:48:35Z</dc:date>
    </item>
  </channel>
</rss>

