<?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: Reading a .csv file into SAS using PROC IMPORT errors out not a valid name in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reading-a-csv-file-into-SAS-using-PROC-IMPORT-errors-out-not-a/m-p/363891#M86225</link>
    <description>&lt;P&gt;Thanks for your response. I tried both of these but I still get same error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;sas -noterminal -set v1 /mypath/temp.csv -set v2 test_csv.dataset /mypath/import.sas

sas -noterminal -set v1 /mypath/temp.csv -set v2 test_csv /mypath/import.sas

&lt;/PRE&gt;&lt;P&gt;Both returns the same error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ERROR: ""test_csv"" is not a valid name.

ERROR: ""test_csv.dataset"" is not a valid name.&lt;/PRE&gt;</description>
    <pubDate>Fri, 02 Jun 2017 17:46:49 GMT</pubDate>
    <dc:creator>rssg83</dc:creator>
    <dc:date>2017-06-02T17:46:49Z</dc:date>
    <item>
      <title>Reading a .csv file into SAS using PROC IMPORT errors out not a valid name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-a-csv-file-into-SAS-using-PROC-IMPORT-errors-out-not-a/m-p/363876#M86219</link>
      <description>&lt;P&gt;I'm a newbie with SAS. I'm trying to convert a CSV file into SAS format. Please find the code and logs below and let me know what is wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;OPTIONS NOFMTERR ;
%let table=%sysget(v1);
%let outfil=%sysget(v2);
%macro importa ;
proc import datafile="&amp;amp;table" out="&amp;amp;outfil" dbms=csv replace ; run ;
%mend importa ;
%importa ;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CSV file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;27697,1,PF,2,33,1,5,21,1987-11-09,0,1983-06-28,1987-11-09,,29,1,11,0,4,0,,32,,0,2,,,0,,I,2016-11-30,23950,4,28&lt;/PRE&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;&lt;P&gt;When I run the sas command like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;sas -noterminal -set v1 /mypath/temp.csv -set v2 /mypath /mypath/import.sas&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it errors out that:&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;NOTE: SAS initialization used:
real time 0.02 seconds
cpu time 0.01 seconds
1 OPTIONS NOFMTERR ;
2
3 %let table=%sysget(v1);
4 %let outfil=%sysget(v2);
5
6 %macro importa ;
7 proc import datafile="&amp;amp;table" out="&amp;amp;outfil" dbms=csv replace ; run ;
8 %mend importa ;
9 %importa ;
ERROR: ""/mypath"" is not a valid name.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
NOTE: The SAS System stopped processing this step because of errors.
10&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2017 17:09:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-a-csv-file-into-SAS-using-PROC-IMPORT-errors-out-not-a/m-p/363876#M86219</guid>
      <dc:creator>rssg83</dc:creator>
      <dc:date>2017-06-02T17:09:59Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a .csv file into SAS using PROC IMPORT errors out not a valid name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-a-csv-file-into-SAS-using-PROC-IMPORT-errors-out-not-a/m-p/363877#M86220</link>
      <description>&lt;P&gt;It appears that&lt;/P&gt;
&lt;P&gt;set v2 /mypath /mypath/import.sas&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;is getting the value of /mypath for V2 because of the space&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;V2 would have to resolve to a valid dataset name or LIbrary.dataset name. So no characters other than letters, digits and underscore and cannot start with a digit&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;set v2 mydatasetname perhaps&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2017 17:17:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-a-csv-file-into-SAS-using-PROC-IMPORT-errors-out-not-a/m-p/363877#M86220</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-06-02T17:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a .csv file into SAS using PROC IMPORT errors out not a valid name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-a-csv-file-into-SAS-using-PROC-IMPORT-errors-out-not-a/m-p/363891#M86225</link>
      <description>&lt;P&gt;Thanks for your response. I tried both of these but I still get same error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;sas -noterminal -set v1 /mypath/temp.csv -set v2 test_csv.dataset /mypath/import.sas

sas -noterminal -set v1 /mypath/temp.csv -set v2 test_csv /mypath/import.sas

&lt;/PRE&gt;&lt;P&gt;Both returns the same error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ERROR: ""test_csv"" is not a valid name.

ERROR: ""test_csv.dataset"" is not a valid name.&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Jun 2017 17:46:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-a-csv-file-into-SAS-using-PROC-IMPORT-errors-out-not-a/m-p/363891#M86225</guid>
      <dc:creator>rssg83</dc:creator>
      <dc:date>2017-06-02T17:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a .csv file into SAS using PROC IMPORT errors out not a valid name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-a-csv-file-into-SAS-using-PROC-IMPORT-errors-out-not-a/m-p/363914#M86233</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where you use this line the OUT= should be a dataset or library.setname and would not use quotes. I didn't look further than the / the first time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc import datafile="&amp;amp;table" out="&amp;amp;outfil" dbms=csv replace ; run ;
&lt;/PRE&gt;
&lt;P&gt;try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc import datafile="&amp;amp;table" out=&amp;amp;outfil dbms=csv replace ; run ;
&lt;/PRE&gt;
&lt;P&gt;but any library referenced needs to exist before the proc import step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If v2 is supposed to be a data set name then test_csv.dataset&amp;nbsp;&amp;nbsp; would be attempting to create/use a dataset with the NAME of dataset in a library named test_csv.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I haven't done any unix(?) command syntax in over 20 years so if there is an issue with the syntax there I can't help.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2017 19:16:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-a-csv-file-into-SAS-using-PROC-IMPORT-errors-out-not-a/m-p/363914#M86233</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-06-02T19:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a .csv file into SAS using PROC IMPORT errors out not a valid name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-a-csv-file-into-SAS-using-PROC-IMPORT-errors-out-not-a/m-p/364094#M86313</link>
      <description>&lt;P&gt;You shouldn't be trying to read or write anything using the root node of your Unix file system, but perhaps that is just a simplied example for posting the question?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also noticed that your sample CSV file does NOT have a line with the column names. If that is true then make sure to tell PROC IMPORT that it needs to generates names by itself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also make sure that the name of your physical file is in all lowercase letters. &amp;nbsp;The directory name part can contain mixed upper and lowercase letters but the membername part of the filename must be all lowercase. &amp;nbsp;For example you could use "~/MySASData/example1" as the name and SAS would create the dataset EXAMPLE1 using the physical file name of 'example1.sas7bdat' in the 'MySASData' directory under your home directory.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If those don't fix the issue then&amp;nbsp;I think that most likely your problem is that PROC IMPORT is not flexible enough to use a quoted physical name as the name for the output dataset. &amp;nbsp;Perhaps if you just use this simple trick you can get it to work?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;OPTIONS NOFMTERR ;
%let table=%sysget(v1);
%let outfil=%sysget(v2);

* Make an empty dataset to create the SYSLAST automatic variable;
data "&amp;amp;outfil"; run;

proc import
  out=&amp;amp;syslast replace
  datafile="&amp;amp;table" dbms=csv 
;
  getnames=no;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 04 Jun 2017 05:49:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-a-csv-file-into-SAS-using-PROC-IMPORT-errors-out-not-a/m-p/364094#M86313</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-06-04T05:49:11Z</dc:date>
    </item>
  </channel>
</rss>

