<?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 concantenate field in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/concantenate-field/m-p/923594#M363602</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;The calculated column &lt;CODE class=" language-sas"&gt;concantenate is&amp;nbsp;not&amp;nbsp;calculated&amp;nbsp;well.&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;For&amp;nbsp;example:&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;For&amp;nbsp;first&amp;nbsp;row&amp;nbsp;value&amp;nbsp;should&amp;nbsp;be&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;M6=2211,M5=2210,M4=2209,M3=2208,M2=2207,M1=2206&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;But I get value-&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;M6=2211,M5=2211,M4=2211,M3=2211,M2=2211,M1=2211&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;Why&amp;nbsp;did&amp;nbsp;it&amp;nbsp;happen?&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Want2(Keep=i M6 M5 M4 M3 M2 M1 _M6_  _M5_ _M4_ _M3_ _M2_ _M1_ caoncantenate);
startdate="01NOV2022"d;
do i = 0 to 58;
M6=intnx('month',startdate,-i);
M5=intnx('month',M6,-1);
M4=intnx('month',M6,-2);
M3=intnx('month',M6,-3);
M2=intnx('month',M6,-4);
M1=intnx('month',M6,-5);
_M6_=put(M6,yymmn4.);
_M5_=put(M6,yymmn4.);
_M4_=put(M6,yymmn4.);
_M3_=put(M6,yymmn4.);
_M2_=put(M6,yymmn4.);
_M1_=put(M6,yymmn4.);
format M6 M5 M4 M3 M2 M1 YYMMn4.;
concantenate=CAT("M6=",_M6_," ,M5=",_M5_," ,M4=",_M4_," ,M3=",_M3_," ,M2=",_M2_," ,M1=",_M1_);/***Why is it not working well???***/
output;
end;
Run;
 &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Apr 2024 12:44:12 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2024-04-09T12:44:12Z</dc:date>
    <item>
      <title>concantenate field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concantenate-field/m-p/923594#M363602</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;The calculated column &lt;CODE class=" language-sas"&gt;concantenate is&amp;nbsp;not&amp;nbsp;calculated&amp;nbsp;well.&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;For&amp;nbsp;example:&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;For&amp;nbsp;first&amp;nbsp;row&amp;nbsp;value&amp;nbsp;should&amp;nbsp;be&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;M6=2211,M5=2210,M4=2209,M3=2208,M2=2207,M1=2206&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;But I get value-&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;M6=2211,M5=2211,M4=2211,M3=2211,M2=2211,M1=2211&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;Why&amp;nbsp;did&amp;nbsp;it&amp;nbsp;happen?&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Want2(Keep=i M6 M5 M4 M3 M2 M1 _M6_  _M5_ _M4_ _M3_ _M2_ _M1_ caoncantenate);
startdate="01NOV2022"d;
do i = 0 to 58;
M6=intnx('month',startdate,-i);
M5=intnx('month',M6,-1);
M4=intnx('month',M6,-2);
M3=intnx('month',M6,-3);
M2=intnx('month',M6,-4);
M1=intnx('month',M6,-5);
_M6_=put(M6,yymmn4.);
_M5_=put(M6,yymmn4.);
_M4_=put(M6,yymmn4.);
_M3_=put(M6,yymmn4.);
_M2_=put(M6,yymmn4.);
_M1_=put(M6,yymmn4.);
format M6 M5 M4 M3 M2 M1 YYMMn4.;
concantenate=CAT("M6=",_M6_," ,M5=",_M5_," ,M4=",_M4_," ,M3=",_M3_," ,M2=",_M2_," ,M1=",_M1_);/***Why is it not working well???***/
output;
end;
Run;
 &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2024 12:44:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concantenate-field/m-p/923594#M363602</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2024-04-09T12:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: concantenate field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concantenate-field/m-p/923596#M363604</link>
      <description>&lt;P&gt;Incorrect spelling.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2024 12:47:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concantenate-field/m-p/923596#M363604</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-04-09T12:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: concantenate field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concantenate-field/m-p/923600#M363606</link>
      <description>&lt;P&gt;you are applying format to the same variable, should be:&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;_M6_=put(M6,yymmn4.);
_M5_=put(M5,yymmn4.);
...&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2024 12:59:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concantenate-field/m-p/923600#M363606</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2024-04-09T12:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: concantenate field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concantenate-field/m-p/923607#M363607</link>
      <description>&lt;P&gt;Did you look at your code:&lt;/P&gt;
&lt;PRE&gt;_M6_=put(M6,yymmn4.);
_M5_=put(M6,yymmn4.);
_M4_=put(M6,yymmn4.);
_M3_=put(M6,yymmn4.);
_M2_=put(M6,yymmn4.);
_M1_=put(M6,yymmn4.);&lt;/PRE&gt;
&lt;P&gt;PUT the same variable 6 times and you get the same value 6 times.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2024 13:30:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concantenate-field/m-p/923607#M363607</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-04-09T13:30:51Z</dc:date>
    </item>
  </channel>
</rss>

