<?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: data series  yymmn4. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/data-series-yymmn4/m-p/618494#M181463</link>
    <description>&lt;P&gt;Proper visual formatting of the code (indentation!!!) would have made it easier for you to identify the mistake. See Maxim 12.&lt;/P&gt;</description>
    <pubDate>Mon, 20 Jan 2020 10:19:02 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-01-20T10:19:02Z</dc:date>
    <item>
      <title>data series  yymmn4.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-series-yymmn4/m-p/618485#M181457</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I am creating series of sas dates .&lt;/P&gt;
&lt;P&gt;I want to create a character column with structure YYMM .&lt;/P&gt;
&lt;P&gt;What is wrong that I get null values ?&lt;/P&gt;
&lt;P&gt;As I known&amp;nbsp; to convert sas date to char date need to use PUT function&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Example1*/
%let start_date=01May2019;
%let end_date=01NOV2019;
data want_month1;
date_sas="&amp;amp;start_date"d;
do while (date_sas&amp;lt;="&amp;amp;end_date"d);
output;
date_sas=intnx('month', date_sas, 1, 's');
end;
format date_sas yymmn4.;
date_char=put(date_sas,yymmn4.);
run;


/*Example2*/
%let start=1905;
%let end=1911;
data want_month2;
  date_start=mdy(mod(&amp;amp;start,100),1,floor(&amp;amp;start/100));
  date_end=mdy(mod(&amp;amp;end,100),1,floor(&amp;amp;end/100));

date_sas=date_start;
do while (date_sas&amp;lt;=date_end);
output;
date_sas=intnx('month', date_sas, 1, 's');
end;
format date_sas yymmn4.;
date_char=put(date_sas,yymmn4.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Jan 2020 09:16:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-series-yymmn4/m-p/618485#M181457</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-01-20T09:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: data series  yymmn4.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-series-yymmn4/m-p/618491#M181461</link>
      <description>Hi Ronein,&lt;BR /&gt;&lt;BR /&gt;Try placing the date_sas, date_char and format assignment inside the do loop and before the output statement.</description>
      <pubDate>Mon, 20 Jan 2020 10:09:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-series-yymmn4/m-p/618491#M181461</guid>
      <dc:creator>geoskiad</dc:creator>
      <dc:date>2020-01-20T10:09:46Z</dc:date>
    </item>
    <item>
      <title>Re: data series  yymmn4.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-series-yymmn4/m-p/618492#M181462</link>
      <description>&lt;P&gt;Put the assignment to DATE_CHAR inside the loop, that should help:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Example1*/
%let start_date=01May2019;
%let end_date=01NOV2019;
data want_month1;
  date_sas="&amp;amp;start_date"d;
  do while (date_sas&amp;lt;="&amp;amp;end_date"d);
    date_char=put(date_sas,yymmn4.);
    output;
    date_sas=intnx('month', date_sas, 1, 's');
    end;
format date_sas yymmn4.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Jan 2020 10:11:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-series-yymmn4/m-p/618492#M181462</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2020-01-20T10:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: data series  yymmn4.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-series-yymmn4/m-p/618494#M181463</link>
      <description>&lt;P&gt;Proper visual formatting of the code (indentation!!!) would have made it easier for you to identify the mistake. See Maxim 12.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2020 10:19:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-series-yymmn4/m-p/618494#M181463</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-01-20T10:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: data series  yymmn4.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-series-yymmn4/m-p/618763#M181560</link>
      <description>&lt;P&gt;It is great but may I ask why should it be inside the loop?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 05:21:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-series-yymmn4/m-p/618763#M181560</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-01-21T05:21:46Z</dc:date>
    </item>
    <item>
      <title>Re: data series  yymmn4.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-series-yymmn4/m-p/618771#M181563</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;It is great but may I ask why should it be inside the loop?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Because it otherwise does not affect the output, which is in the loop. The explicit output statement disables the implicit output that SAS would normally compile at the end of the data step iteration.&lt;/P&gt;
&lt;P&gt;Anything that is intended to have an effect on the expected output needs to happen&amp;nbsp;&lt;EM&gt;before&lt;/EM&gt; the output statement, naturally. And at the same frequency.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 06:24:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-series-yymmn4/m-p/618771#M181563</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-01-21T06:24:50Z</dc:date>
    </item>
  </channel>
</rss>

