<?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: Proc import variable name mm/dd/yy in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-import-variable-name-mm-dd-yy/m-p/534337#M146617</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/49486"&gt;@hhchenfx&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Memname is always uppercase in the dictionary tables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;...
memname eq 'CLIENT' and
...&lt;/PRE&gt;</description>
    <pubDate>Sun, 10 Feb 2019 21:35:02 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2019-02-10T21:35:02Z</dc:date>
    <item>
      <title>Proc import variable name mm/dd/yy</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-import-variable-name-mm-dd-yy/m-p/534091#M146482</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I import an xlsx file with column is day of month say, &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/FONT&gt;2/1/2019 , 12/2/2019...&lt;/P&gt;
&lt;P&gt;The SAS data then has variable name of &lt;FONT color="#FF0000"&gt;_&lt;/FONT&gt;2_1_2019 , _2_2_2019.&lt;/P&gt;
&lt;P&gt;So the first number (1) is gone.&lt;/P&gt;
&lt;P&gt;Can you help me to fix it to make SAS variable name 12_1_2019?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HHCFX&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	proc import datafile="C:\Users\HPNEW\Dropbox\report_V1.xlsx"
	out=client dbms=Excel replace; 
	sheet ='raw Data' ;
	getnames=yes; 
	run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Feb 2019 23:28:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-import-variable-name-mm-dd-yy/m-p/534091#M146482</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2019-02-08T23:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import variable name mm/dd/yy</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-import-variable-name-mm-dd-yy/m-p/534111#M146491</link>
      <description>&lt;P&gt;Using SAS University Edition, 12/1/2019 imports as _12_1_2019. That, methinks, is reasonable since a normal SAS variable name can't start with a number, and can only include numbers, letters and the underscore character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, if your version of SAS loses the first digit, you could always use something like:&lt;CODE class=" language-sas"&gt;
&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options validvarname=any;
proc import datafile="/folders/myfolders/test.xlsx"
            out=have replace dbms=xlsx;
  getnames=yes;
  sheet='sheet1';
run;

proc sql noprint;
  select catx('=',catt("'",name,"'n"),catt('_',translate(name,'_','/')))
    into :varnames separated by ' '
    from dictionary.columns
      where libname eq 'WORK' and
            memname eq 'HAVE' and
            anydigit(substr(name,1,1))
  ;
quit;

data want;
  set have (rename=(&amp;amp;varnames.));
run;

options validvarname=v7;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Feb 2019 01:36:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-import-variable-name-mm-dd-yy/m-p/534111#M146491</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2019-02-09T01:36:02Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import variable name mm/dd/yy</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-import-variable-name-mm-dd-yy/m-p/534336#M146616</link>
      <description>&lt;P&gt;Thank you for your help.&lt;/P&gt;
&lt;P&gt;Somehow SAS return a notice for the SQL as below.&lt;/P&gt;
&lt;P&gt;HHCFX&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;113 proc sql noprint;&lt;BR /&gt;114 select catx('=',catt("'",name,"'n"),catt('_',translate(name,'_','/')))&lt;BR /&gt;115 into :varnames separated by ' '&lt;BR /&gt;116 from dictionary.columns&lt;BR /&gt;117 where libname eq 'WORK' and&lt;BR /&gt;118 memname eq 'Client' and&lt;BR /&gt;119 anydigit(substr(name,1,1))&lt;BR /&gt;120 ;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;NOTE: No rows were selected.&lt;/FONT&gt;&lt;BR /&gt;121 quit;&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;/P&gt;</description>
      <pubDate>Sun, 10 Feb 2019 21:20:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-import-variable-name-mm-dd-yy/m-p/534336#M146616</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2019-02-10T21:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import variable name mm/dd/yy</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-import-variable-name-mm-dd-yy/m-p/534337#M146617</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/49486"&gt;@hhchenfx&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Memname is always uppercase in the dictionary tables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;...
memname eq 'CLIENT' and
...&lt;/PRE&gt;</description>
      <pubDate>Sun, 10 Feb 2019 21:35:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-import-variable-name-mm-dd-yy/m-p/534337#M146617</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-02-10T21:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import variable name mm/dd/yy</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-import-variable-name-mm-dd-yy/m-p/534345#M146618</link>
      <description>&lt;P&gt;What version of SAS are you using?&lt;/P&gt;
&lt;P&gt;Let's make a sample XLSX file.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  input (v1-v4) (:$20.);
cards;
Name 12/01/2018 01/01/2019 02/01/2019
AAA 10 20 30
BBB 40 50 60
;

filename xlsx temp;
proc export data=have outfile=xlsx dbms=xlsx replace;
  putnames=no;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And read it with PROC IMPORT.&lt;/P&gt;
&lt;PRE&gt;605   %put &amp;amp;=sysvlong ;
SYSVLONG=9.04.01M5P091317
606   options validvarname=v7 ;
607   proc import dbms=xlsx datafile=xlsx out=want replace ;
608     getnames=yes;
609   run;

NOTE:    Variable Name Change.  12/01/2018 -&amp;gt; _12_01_2018
NOTE:    Variable Name Change.  01/01/2019 -&amp;gt; _01_01_2019
NOTE:    Variable Name Change.  02/01/2019 -&amp;gt; _02_01_2019
NOTE: One or more variables were converted because the data type is not supported by the V9 engine. For
      more details, run with options MSGLEVEL=I.
NOTE: The import data set has 2 observations and 4 variables.
&lt;/PRE&gt;</description>
      <pubDate>Sun, 10 Feb 2019 22:31:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-import-variable-name-mm-dd-yy/m-p/534345#M146618</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-02-10T22:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import variable name mm/dd/yy</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-import-variable-name-mm-dd-yy/m-p/534520#M146678</link>
      <description>&lt;P&gt;Thank you both for your help!&lt;/P&gt;
&lt;P&gt;It works now.&lt;/P&gt;
&lt;P&gt;HHCFX&lt;/P&gt;</description>
      <pubDate>Mon, 11 Feb 2019 16:26:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-import-variable-name-mm-dd-yy/m-p/534520#M146678</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2019-02-11T16:26:50Z</dc:date>
    </item>
  </channel>
</rss>

