<?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: Vname function understanding in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Vname-function-understanding/m-p/823588#M325202</link>
    <description>&lt;P&gt;And instead of using an array, I would transpose first and then extract the year from _NAME_..&lt;/P&gt;</description>
    <pubDate>Fri, 15 Jul 2022 23:18:42 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-07-15T23:18:42Z</dc:date>
    <item>
      <title>Vname function understanding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Vname-function-understanding/m-p/823490#M325151</link>
      <description>&lt;P&gt;Can someone help me understand the below line which has vname funcion?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;FISC_YEAR = put(input(substr(vname(x),find(vname(x),"_",-length(vname(x)))+2),2.),z2.);&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Jul 2022 10:21:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Vname-function-understanding/m-p/823490#M325151</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2022-07-15T10:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: Vname function understanding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Vname-function-understanding/m-p/823491#M325152</link>
      <description>&lt;P&gt;I think someone has found a very difficult way to do something very simple. But it seems as if you have changed the actual variable name to X, which doesn't really help. What was the actual variable name?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;David, you need to run this code and see what value of FISC_YEAR results and what the value of X was. You can add PUT statements into your data step code, or just examine the output data set.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 10:52:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Vname-function-understanding/m-p/823491#M325152</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-07-15T10:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: Vname function understanding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Vname-function-understanding/m-p/823494#M325153</link>
      <description>&lt;P&gt;This would make some sense if x was in fact a reference to an array (not a single variable) and the code was part of a DO OVER block.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Posting single statements out of context is usually very un-helpful.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 12:01:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Vname-function-understanding/m-p/823494#M325153</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-07-15T12:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: Vname function understanding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Vname-function-understanding/m-p/823502#M325156</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292396"&gt;@David_Billa&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;following the reply of&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;, I would assume that the variable names in the array are of the form "%%%%_YY" with the "YY" being the last two digits of the year. Your function than extracts the YY as a numeric with showing an eventual leading "0" in the format z2.&lt;/P&gt;
&lt;P&gt;Best&lt;/P&gt;
&lt;P&gt;Markus&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 13:21:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Vname-function-understanding/m-p/823502#M325156</guid>
      <dc:creator>MarkusWeick</dc:creator>
      <dc:date>2022-07-15T13:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: Vname function understanding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Vname-function-understanding/m-p/823513#M325162</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/401244"&gt;@MarkusWeick&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I would assume that the variable names in the array are of the form "%%%%_YY" with the "YY" being the last two digits of the year.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I would expect one additional character between the last underscore and "YY" because otherwise the INPUT function would start to read at the second digit of the year ("Y&lt;U&gt;Y&lt;/U&gt;").&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 14:22:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Vname-function-understanding/m-p/823513#M325162</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-07-15T14:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: Vname function understanding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Vname-function-understanding/m-p/823519#M325166</link>
      <description>I think you are right. I didn't count carefully enough.</description>
      <pubDate>Fri, 15 Jul 2022 14:32:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Vname-function-understanding/m-p/823519#M325166</guid>
      <dc:creator>MarkusWeick</dc:creator>
      <dc:date>2022-07-15T14:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: Vname function understanding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Vname-function-understanding/m-p/823571#M325190</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/401244"&gt;@MarkusWeick&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292396"&gt;@David_Billa&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;following the reply of&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;, I would assume that the variable names in the array are of the form "%%%%_YY" with the "YY" being the last two digits of the year. Your function than extracts the YY as a numeric with showing an eventual leading "0" in the format z2.&lt;/P&gt;
&lt;P&gt;Best&lt;/P&gt;
&lt;P&gt;Markus&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Even so, and even if the offset were corrected, this is an ugly way to get the fiscal year.&amp;nbsp; SCAN for the last (i.e. "-1") word separated by '_'&amp;nbsp; would be much easier:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
DATA _NULL_;
   ARRAY X {*} assets_74  assets_75  assets_76 (3*0);
   DO i=1 to 3;
     FISC_YEAR=INPUT(SCAN(VNAME(X{i}),-1,'_'),2.);
     put i= x{i}= fisc_year=;
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course, if the FISC_YEAR calculation is inside a loop, then other within-loop work better be done, because FISC_YEAR will keep only the last value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The problem statement definitely needs context.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 19:10:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Vname-function-understanding/m-p/823571#M325190</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2022-07-15T19:10:17Z</dc:date>
    </item>
    <item>
      <title>Re: Vname function understanding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Vname-function-understanding/m-p/823588#M325202</link>
      <description>&lt;P&gt;And instead of using an array, I would transpose first and then extract the year from _NAME_..&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 23:18:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Vname-function-understanding/m-p/823588#M325202</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-07-15T23:18:42Z</dc:date>
    </item>
  </channel>
</rss>

