<?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 Creating values in a column that is the name of other column. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-values-in-a-column-that-is-the-name-of-other-column/m-p/636930#M189297</link>
    <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm creating a new column on a step DATA SET that I'm working on that intends to have the content of a column that already exists, but actually what SAS is making is to return the name of those columns that already exists. But to supply my needs in my proccess I need to make the SAS unsderstand that I really want are the contents. The image below show the result that I'm having:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="claudiopcjr_1-1585844446198.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/37684i6FE13B60A7BBD134/image-size/large?v=v2&amp;amp;px=999" role="button" title="claudiopcjr_1-1585844446198.png" alt="claudiopcjr_1-1585844446198.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the code that I'm using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA TABELA_HISTORICA_2;&lt;BR /&gt;SET TABELA_HISTORICA;&lt;/P&gt;&lt;P&gt;SEGM_PJ_P12M = "SEGM_PJ_"||PUT(YEAR(INTNX('MONTH',FECHAPER_STRT,12,'E')),z4.)||PUT(MONTH(INTNX('MONTH',FECHAPER_STRT,12,'E')),Z2.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And below are the results that I'm expecting to have:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="claudiopcjr_2-1585844534886.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/37685iE9CD0569A9753FC3/image-size/large?v=v2&amp;amp;px=999" role="button" title="claudiopcjr_2-1585844534886.png" alt="claudiopcjr_2-1585844534886.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know any change that I'd do on the code that I provided to reach the expected results ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 02 Apr 2020 16:23:19 GMT</pubDate>
    <dc:creator>claudiopcjr</dc:creator>
    <dc:date>2020-04-02T16:23:19Z</dc:date>
    <item>
      <title>Creating values in a column that is the name of other column.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-values-in-a-column-that-is-the-name-of-other-column/m-p/636930#M189297</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm creating a new column on a step DATA SET that I'm working on that intends to have the content of a column that already exists, but actually what SAS is making is to return the name of those columns that already exists. But to supply my needs in my proccess I need to make the SAS unsderstand that I really want are the contents. The image below show the result that I'm having:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="claudiopcjr_1-1585844446198.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/37684i6FE13B60A7BBD134/image-size/large?v=v2&amp;amp;px=999" role="button" title="claudiopcjr_1-1585844446198.png" alt="claudiopcjr_1-1585844446198.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the code that I'm using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA TABELA_HISTORICA_2;&lt;BR /&gt;SET TABELA_HISTORICA;&lt;/P&gt;&lt;P&gt;SEGM_PJ_P12M = "SEGM_PJ_"||PUT(YEAR(INTNX('MONTH',FECHAPER_STRT,12,'E')),z4.)||PUT(MONTH(INTNX('MONTH',FECHAPER_STRT,12,'E')),Z2.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And below are the results that I'm expecting to have:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="claudiopcjr_2-1585844534886.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/37685iE9CD0569A9753FC3/image-size/large?v=v2&amp;amp;px=999" role="button" title="claudiopcjr_2-1585844534886.png" alt="claudiopcjr_2-1585844534886.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know any change that I'd do on the code that I provided to reach the expected results ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2020 16:23:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-values-in-a-column-that-is-the-name-of-other-column/m-p/636930#M189297</guid>
      <dc:creator>claudiopcjr</dc:creator>
      <dc:date>2020-04-02T16:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: Creating values in a column that is the name of other column.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-values-in-a-column-that-is-the-name-of-other-column/m-p/636963#M189309</link>
      <description>&lt;P&gt;PUT creates character values and there is nothing there that references back to a variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would try:&lt;/P&gt;
&lt;PRE&gt;DATA TABELA_HISTORICA_2;
SET TABELA_HISTORICA;
SEGM_PJ_P12M = vvaluex(cats("SEGM_PJ_",PUT(iNTNX('MONTH',FECHAPER_STRT,12,'E'),yymmn6.),best12.));
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The VVALUEX function will actually return a CHARACTER variable with the formatted value of the variable that the name resolves to. &lt;/P&gt;
&lt;P&gt;The format YYMMx does year and month number formats. The N says not to use a separator so the YYMMN6. format returns values like 200801 from the date. No need to create separate incremented dates, format pieces and then stick together.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2020 17:20:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-values-in-a-column-that-is-the-name-of-other-column/m-p/636963#M189309</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-04-02T17:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: Creating values in a column that is the name of other column.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-values-in-a-column-that-is-the-name-of-other-column/m-p/636971#M189310</link>
      <description>&lt;P&gt;Use INTCK() function to calculate an index into an array.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA TABELA_HISTORICA_2;
SET TABELA_HISTORICA;
  array _x segm_pj_200: ;
  index=1+intck('month','01JAN2008'd,FECHAPER_STRT);
  if 1 &amp;lt;= index &amp;lt;= dim(_x) then SEGM_PJ_P12M=_x(index);
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Apr 2020 17:29:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-values-in-a-column-that-is-the-name-of-other-column/m-p/636971#M189310</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-04-02T17:29:33Z</dc:date>
    </item>
  </channel>
</rss>

