<?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 with Numeric/Character Variable in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Proc-import-with-Numeric-Character-Variable/m-p/769097#M30833</link>
    <description>&lt;P&gt;hi, apologies i edited my post and changed the file name to .xlsx. Actually, i also converted it to csv and tried to import using proc import but i still had some issues and decided to post here the issue with the .xlsx.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The file is not in SAS at the moment and i need to write a code to able to import it from a specific location rather than import it manually.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In terms of the type of 20HA i need SAS to see and read them. i don't have a specific preference&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Sep 2021 11:13:15 GMT</pubDate>
    <dc:creator>Toni2</dc:creator>
    <dc:date>2021-09-22T11:13:15Z</dc:date>
    <item>
      <title>Proc import with Numeric/Character Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-import-with-Numeric-Character-Variable/m-p/769090#M30831</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to import Excel file into SAS and i have some issues. More specifically, one of the Excel columns contains a mixed of number and character/numbers values (see below) . The dataset is quite big with more than 100k raws. I use proc import to import to SAS however, SAS has replaced all the character-number values with dots. ( for example, instead of&amp;nbsp; 20HA in SAS i can see .&amp;nbsp; (dots)) .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I read an article that for&amp;nbsp;&lt;SPAN&gt;DBMS=EXCEL or EXCELCS&lt;/SPAN&gt; i need to use the MIXED=Yes option which i did it but i still get an error that the MIXED statement is not valid or used out of proper order&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below you can see my code and SAS log&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="130"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="130"&gt;11319&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;11319&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;11319&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;11319&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;11319&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;11319&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;20HA&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;20HA&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;20HA&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;20HA&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;20HA&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc import out = data_raw dbms = excelcs datafile = &lt;SPAN&gt;"C:\Documents\data.xlsx"&lt;/SPAN&gt; replace;&lt;BR /&gt;sheet = "data";&lt;BR /&gt;version = "2002";&lt;BR /&gt;server = "servername";&lt;BR /&gt;port = 8958;&lt;BR /&gt;ServerUser = "&amp;amp;userID";&lt;BR /&gt;ServerPass = "&amp;amp;pass"; &lt;BR /&gt;mixed=YES;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LOG&lt;/P&gt;
&lt;P&gt;__________________________________________________________________________&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;33 mixed=YES;&lt;BR /&gt;_____&lt;BR /&gt;180&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;34 run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: CLI error trying to establish connection: [Microsoft][ODBC Excel Driver]General error Unable to open registry key Temporary&amp;nbsp;(volatile) Ace DSN for process 0x1c2c Thread 0x1d40 DBC 0x21a84e8&amp;nbsp;Excel'.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;ERROR: Error in the LIBNAME statement.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Connection Failed. See log for details.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;NOTE: PROCEDURE IMPORT used (Total process time):&lt;BR /&gt;&lt;BR /&gt;&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>Wed, 22 Sep 2021 10:59:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-import-with-Numeric-Character-Variable/m-p/769090#M30831</guid>
      <dc:creator>Toni2</dc:creator>
      <dc:date>2021-09-22T10:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import with Numeric/Character Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-import-with-Numeric-Character-Variable/m-p/769091#M30832</link>
      <description>&lt;P&gt;Why do you read a csv file as Excel? If it is a true CSV (comma or semicolon-separated text) file, copy it to your SAS environment (unless it's already available there) and read it with a data step, where you can control how this column is read and converted.&lt;/P&gt;
&lt;P&gt;Which type should the column be? If numeric, to which value should 20HA be translated?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 10:53:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-import-with-Numeric-Character-Variable/m-p/769091#M30832</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-09-22T10:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import with Numeric/Character Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-import-with-Numeric-Character-Variable/m-p/769097#M30833</link>
      <description>&lt;P&gt;hi, apologies i edited my post and changed the file name to .xlsx. Actually, i also converted it to csv and tried to import using proc import but i still had some issues and decided to post here the issue with the .xlsx.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The file is not in SAS at the moment and i need to write a code to able to import it from a specific location rather than import it manually.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In terms of the type of 20HA i need SAS to see and read them. i don't have a specific preference&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 11:13:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-import-with-Numeric-Character-Variable/m-p/769097#M30833</guid>
      <dc:creator>Toni2</dc:creator>
      <dc:date>2021-09-22T11:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import with Numeric/Character Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-import-with-Numeric-Character-Variable/m-p/769178#M30836</link>
      <description>&lt;P&gt;First thing, Excel has no concept of variable so "variable" properties when using a tool like Proc Import guesses as to variable (column) properties using a very few rows of data. So if the first 20 values in a column look like numbers the procedure guesses that the data is supposed to be numeric because Excel enforces no rules at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use Import with a CSV and set the option Guessingrows=max; to examine all the rows of the file before setting properties.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you have "issues" the best thing is to copy text from the log showing the source of the issues and paste the log into a text box opened on the forum with the &amp;lt;/&amp;gt; icon that appears above the message window. Then describe the "issue" you have.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: If you are going to read multiple similar structure files you will be better off to write a data step to read each one with the same variables, types and lengths to avoid problems later when you need to combine data.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 14:33:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-import-with-Numeric-Character-Variable/m-p/769178#M30836</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-09-22T14:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import with Numeric/Character Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-import-with-Numeric-Character-Variable/m-p/769190#M30837</link>
      <description>&lt;P&gt;hi, thanks for the advices and sorry for the confusion. I have now tried with an CSV. I saved the Excel file in a CSV and use the code below but i still get some errors. See below an extract from the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please note i have edited/removed some fields due to sensitive data&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc import out = data_raw dbms = csv datafile = "\c:files\data.csv" replace;
    sheet		= "data";
	version		= "2002";
	server		= "server";
	port		= 8000;
	ServerUser = "servername";
    ServerPass = "&amp;amp;pwin"; 
	Guessingrows=max;
run;
&lt;/PRE&gt;
&lt;PRE&gt;NOTE: The previous statement has been deleted.
NOTE: The previous statement has been deleted.
NOTE: The previous statement has been deleted.
NOTE: The previous statement has been deleted.
SYMBOLGEN:  Macro variable LWIN resolves to ID
27             sheet		= "data";
               _____
               180
NOTE: The previous statement has been deleted.
28         	version		= "2002";
            _______
            180
SYMBOLGEN:  Macro variable PWIN resolves to {SAS002}3FE19032333A577A1D857AEF45BAD3BA141313DF
29         	server		= "servername";
            ______
            180
NOTE: The previous statement has been deleted.
30         	port		= 8000;
            ____
            180
31         	ServerUser = "serveruser";
            __________
            180
32             ServerPass = "&amp;amp;pwin";
               __________
               180
2                                                          The SAS System                        15:43 Wednesday, September 22, 2021

ERROR 180-322: Statement is not valid or it is used out of proper order.

33         	Guessingrows=max;
34         run;

ERROR: Physical file does not exist, /data.csv. 
ERROR: Import unsuccessful.  See SAS Log for details.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used (Total process time):
      &lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Sep 2021 15:00:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-import-with-Numeric-Character-Variable/m-p/769190#M30837</guid>
      <dc:creator>Toni2</dc:creator>
      <dc:date>2021-09-22T15:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import with Numeric/Character Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-import-with-Numeric-Character-Variable/m-p/769215#M30838</link>
      <description>&lt;P&gt;Where is the file you are trying to read?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it available on a disk that is directly accessible from the server where SAS is running?&lt;/P&gt;
&lt;P&gt;It kind of looks like you are trying to use SAS PCFILES Server to access files that are on a Windows machine (or at least accessible via the Windows machine) but not accessible directly from the machine where SAS itself is running.&lt;/P&gt;
&lt;P&gt;But you have messed up the details. In particular you cannot use DBMS=CSV in PROC IMPORT.&amp;nbsp; That is for accessing files directly.&amp;nbsp; So if the file is directly accessible then you don't need all of those PCFILES server options like SERVER or SERVERUSER etc.&lt;/P&gt;
&lt;P&gt;Also your filename is confusing as it is starting with the root node of / like you are trying to access a file in the Unix filesystem.&amp;nbsp; But then it includes a drive letter, C:, like you are trying to access a file on a Windows machine.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 15:40:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-import-with-Numeric-Character-Variable/m-p/769215#M30838</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-09-22T15:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import with Numeric/Character Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-import-with-Numeric-Character-Variable/m-p/769810#M30846</link>
      <description>&lt;P&gt;Thank you for the support. The file that i try to import is in a shared drive. I don't know if it is directly accessible from SAS but when i run the below code it imports the Excel file successfully but with the issue that i refer at the beginning of this article (some character-number values appear as . dots in SAS). Does it mean that it is not directly accessible?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I edit the most of the details in the version, server, port&amp;nbsp; and file name as well due to the sensitive of data for this reason doesn't make sense. However, i have used the below code and i am sure the path is correct&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc import out = data_raw dbms = excelcs datafile = "\\SAS Programs\data.xlsx" replace;
    sheet		= "data";
	version		= "2002";
	server		= "servername";
	port		= 5000;
	ServerUser = "&amp;amp;lwin";
    ServerPass = "&amp;amp;pwin"; 
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Sep 2021 08:22:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-import-with-Numeric-Character-Variable/m-p/769810#M30846</guid>
      <dc:creator>Toni2</dc:creator>
      <dc:date>2021-09-23T08:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import with Numeric/Character Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-import-with-Numeric-Character-Variable/m-p/770020#M30851</link>
      <description>&lt;P&gt;By using a DBMS type that requires the PC FILES server you are able to access a file using the machine where the PC FILES server is running.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The EXCELCS uses the PC FILES server.&lt;/P&gt;
&lt;P&gt;I do not see anything in the documentation that says you can use it to access a plain old text file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV id="p0o8ysz8v67k3ln1afpnwks1bs6h" class="xisDoc-noteIndent"&gt;&lt;SPAN class="xisDoc-noteGenText"&gt;Note:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;All DBMS= specifications refer to local access, except for these specifications:
&lt;UL class="xisDoc-listUnordered"&gt;
&lt;LI class="xisDoc-item"&gt;DBMS=ACCESSCS&lt;/LI&gt;
&lt;LI class="xisDoc-item"&gt;DBMS=EXCELCS&lt;/LI&gt;
&lt;LI class="xisDoc-item"&gt;DBMS=PCFS&lt;/LI&gt;
&lt;/UL&gt;
&lt;/DIV&gt;
&lt;P class="xisDoc-paraSimple"&gt;These files are accessed remotely by connecting to the SAS PC Files Server on Microsoft Windows.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Thu, 23 Sep 2021 19:34:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-import-with-Numeric-Character-Variable/m-p/770020#M30851</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-09-23T19:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import with Numeric/Character Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-import-with-Numeric-Character-Variable/m-p/770192#M30855</link>
      <description>thank you &lt;BR /&gt;</description>
      <pubDate>Fri, 24 Sep 2021 11:13:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-import-with-Numeric-Character-Variable/m-p/770192#M30855</guid>
      <dc:creator>Toni2</dc:creator>
      <dc:date>2021-09-24T11:13:26Z</dc:date>
    </item>
  </channel>
</rss>

