<?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: Reference to a numeric variable name in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-reference-to-a-numeric-variable-name/m-p/794242#M254666</link>
    <description>&lt;P&gt;Thank you for your response&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/281770"&gt;@maguiremq&lt;/a&gt;&amp;nbsp;and &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;, but it doesn't work that way.&lt;BR /&gt;I tried to perform three different actions with that variable with a numeric name, but had no success.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2.PNG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/68175i1D81F308965101D9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="2.PNG" alt="2.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/68176i948204D0731304FC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="3.PNG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/68177iDD864DCF6FDCCC8B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="3.PNG" alt="3.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 03 Feb 2022 15:33:04 GMT</pubDate>
    <dc:creator>webart999ARM</dc:creator>
    <dc:date>2022-02-03T15:33:04Z</dc:date>
    <item>
      <title>How to reference to a numeric variable name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-reference-to-a-numeric-variable-name/m-p/794233#M254661</link>
      <description>&lt;P&gt;Hello folks.&lt;BR /&gt;&lt;BR /&gt;I faced some strange thing today which I have never seen before.&lt;BR /&gt;After running a reference code that I have to use, I find out that some variables have numeric variable names (i.e. 1, 2, 3).&lt;/P&gt;
&lt;P&gt;I want to make some changes to them but I have no idea how to refer them.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/68174i909EC7022DAB1F46/image-size/medium?v=v2&amp;amp;px=400" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Task needs to be accomplished - Convert values in variables 1, 2, and 3 from numeric to char.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind Regards&lt;/P&gt;
&lt;P&gt;Artur&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 15:44:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-reference-to-a-numeric-variable-name/m-p/794233#M254661</guid>
      <dc:creator>webart999ARM</dc:creator>
      <dc:date>2022-02-03T15:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: Reference to a numeric variable name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-reference-to-a-numeric-variable-name/m-p/794234#M254662</link>
      <description>&lt;P&gt;That's a name literal, and it isn't a valid name. I'm assuming you have&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options validvarname = any;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;specified somewhere.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have to refer to it like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;"1"n&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options validvarname = any;
data want;
input '1'n;
datalines;
11
11
.
11
11
;
run;

proc means data = want;
	var '1'n;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Probably a good idea to rename those to avoid the hassle of name literals.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 15:23:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-reference-to-a-numeric-variable-name/m-p/794234#M254662</guid>
      <dc:creator>maguiremq</dc:creator>
      <dc:date>2022-02-03T15:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: Reference to a numeric variable name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-reference-to-a-numeric-variable-name/m-p/794235#M254663</link>
      <description>&lt;P&gt;Someone must have changed your VALIDVARNAME option setting to ANY to allow it to create names like that.&lt;/P&gt;
&lt;P&gt;To reference those non-standard names in SAS code you need to use name literals.&amp;nbsp; Add quotes and the letter N to the name.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq;
  tables  '1'n  "2"N ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Feb 2022 15:23:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-reference-to-a-numeric-variable-name/m-p/794235#M254663</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-02-03T15:23:05Z</dc:date>
    </item>
    <item>
      <title>Re: Reference to a numeric variable name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-reference-to-a-numeric-variable-name/m-p/794242#M254666</link>
      <description>&lt;P&gt;Thank you for your response&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/281770"&gt;@maguiremq&lt;/a&gt;&amp;nbsp;and &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;, but it doesn't work that way.&lt;BR /&gt;I tried to perform three different actions with that variable with a numeric name, but had no success.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2.PNG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/68175i1D81F308965101D9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="2.PNG" alt="2.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/68176i948204D0731304FC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="3.PNG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/68177iDD864DCF6FDCCC8B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="3.PNG" alt="3.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 15:33:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-reference-to-a-numeric-variable-name/m-p/794242#M254666</guid>
      <dc:creator>webart999ARM</dc:creator>
      <dc:date>2022-02-03T15:33:04Z</dc:date>
    </item>
    <item>
      <title>Re: Reference to a numeric variable name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-reference-to-a-numeric-variable-name/m-p/794246#M254668</link>
      <description>&lt;P&gt;Run a proc contents on the input data set and show that output please. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Or to fix the overall issue:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Add this line to your AUTOEXEC : options validvarname=v7;&lt;/LI&gt;
&lt;LI&gt;Restart your SAS session&lt;/LI&gt;
&lt;LI&gt;Reimport your data and SAS will provide usable names.&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Thu, 03 Feb 2022 15:46:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-reference-to-a-numeric-variable-name/m-p/794246#M254668</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-02-03T15:46:43Z</dc:date>
    </item>
    <item>
      <title>Re: Reference to a numeric variable name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-reference-to-a-numeric-variable-name/m-p/794248#M254669</link>
      <description>&lt;P&gt;Most likely you have leading blanks also, which would cause the same effect:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options validvarname=any;

data have;
input " 1"n;
datalines;
1
;

data want;
set have;
one = "1"n;
run;

proc sql noprint;
select nliteral(name) into :names separated by " " from dictionary.columns
where libname = "WORK" and memname = "HAVE";
quit;

%put &amp;amp;names.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The SQL will display the real names of the variables, which you can then use in further code to rename them.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 15:50:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-reference-to-a-numeric-variable-name/m-p/794248#M254669</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-02-03T15:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: Reference to a numeric variable name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-reference-to-a-numeric-variable-name/m-p/794249#M254670</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Added '&lt;SPAN&gt;options validvarname=v7;' at the top of my program.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Now I have _1, _2, and _3 variables instead of 1, 2, and 3.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Appreciate all your responses guys.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Have a good rest of your day.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Artur&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 15:52:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-reference-to-a-numeric-variable-name/m-p/794249#M254670</guid>
      <dc:creator>webart999ARM</dc:creator>
      <dc:date>2022-02-03T15:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: Reference to a numeric variable name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-reference-to-a-numeric-variable-name/m-p/794252#M254672</link>
      <description>&lt;P&gt;Interesting approach.&lt;/P&gt;
&lt;P&gt;I will definitely try it.&lt;/P&gt;
&lt;P&gt;Thank you&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 15:54:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-reference-to-a-numeric-variable-name/m-p/794252#M254672</guid>
      <dc:creator>webart999ARM</dc:creator>
      <dc:date>2022-02-03T15:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: Reference to a numeric variable name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-reference-to-a-numeric-variable-name/m-p/794259#M254674</link>
      <description>&lt;P&gt;Since you import the data yourself, you can fix it there, which I also recommend. My approach is for situations where you receive a SAS dataset with such (IMO stupid) names and have to proceed from there.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 16:06:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-reference-to-a-numeric-variable-name/m-p/794259#M254674</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-02-03T16:06:28Z</dc:date>
    </item>
  </channel>
</rss>

