<?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: Importing csv file with columns containing special characters and multiple delimiters in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Importing-csv-file-with-columns-containing-special-characters/m-p/720851#M223338</link>
    <description>&lt;P&gt;The variable names I wrote follow the SAS rules, so I don't think you need to rename them.&lt;/P&gt;
&lt;P&gt;If you wanna rename in data step,&amp;nbsp;rewrite variable name both after length and input&amp;nbsp;statement.&lt;/P&gt;</description>
    <pubDate>Mon, 22 Feb 2021 08:24:24 GMT</pubDate>
    <dc:creator>japelin</dc:creator>
    <dc:date>2021-02-22T08:24:24Z</dc:date>
    <item>
      <title>Importing csv file with columns containing special characters and multiple delimiters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-csv-file-with-columns-containing-special-characters/m-p/720830#M223325</link>
      <description>&lt;P&gt;Hi everyone ,&lt;/P&gt;&lt;P&gt;I have to convert a CSV file into a SAS Dataset . The CSV file has column names containing special characters like '/' and '-' and spaces .The file contains column names like 'E/I','Sub-Category' . There are also multiple delimiters like commas ,tilde used in the file. I am using data step and the infile statement to specify multiple delimiters .&lt;/P&gt;&lt;P&gt;I used the validvarname=v7 option before the data step , however it treats the 'Sub-Category' column as as number list and gives the following error "Missing numeric suffix on a numbered variable list (sub-category)".&lt;/P&gt;&lt;P&gt;How do I import this file?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2021 06:42:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-csv-file-with-columns-containing-special-characters/m-p/720830#M223325</guid>
      <dc:creator>kaziumair</dc:creator>
      <dc:date>2021-02-22T06:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: Importing csv file with columns containing special characters and multiple delimiters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-csv-file-with-columns-containing-special-characters/m-p/720838#M223331</link>
      <description>&lt;P&gt;Can you provide a csv and code to reproduce the error?&lt;BR /&gt;"Sub-category" is being treated as a variable.&lt;BR /&gt;You can't use "-" in SAS variable names.&lt;/P&gt;
&lt;P&gt;It represents a list of numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2021 06:59:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-csv-file-with-columns-containing-special-characters/m-p/720838#M223331</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2021-02-22T06:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: Importing csv file with columns containing special characters and multiple delimiters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-csv-file-with-columns-containing-special-characters/m-p/720840#M223332</link>
      <description>&lt;P&gt;Hi ,thank you for responding.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cannot provide the original file , created a dummy file containing column sub-category.&lt;/P&gt;&lt;P&gt;Also attaching the code&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2021 07:15:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-csv-file-with-columns-containing-special-characters/m-p/720840#M223332</guid>
      <dc:creator>kaziumair</dc:creator>
      <dc:date>2021-02-22T07:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: Importing csv file with columns containing special characters and multiple delimiters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-csv-file-with-columns-containing-special-characters/m-p/720846#M223335</link>
      <description>&lt;P&gt;You can't use a space or - in a variable name.&lt;BR /&gt;Since csv is quoted, use the dsd option.&lt;BR /&gt;The first line is not data, so use firstobs to import from the second line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;how is this code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data demo_test;
  length id 8 firstname $7 lastname $10 department $10 dateofjoining 8 subcategory $40;
	infile "C:\Users\test\df-demo.csv" dsd firstobs=2;
	input id 
		  firstname  
		  lastname  
		  department  
		  dateofjoining 
		  subcategory ;
	informat dateofjoining mmddyy10.;
	format dateofjoining date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Feb 2021 07:40:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-csv-file-with-columns-containing-special-characters/m-p/720846#M223335</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2021-02-22T07:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: Importing csv file with columns containing special characters and multiple delimiters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-csv-file-with-columns-containing-special-characters/m-p/720847#M223336</link>
      <description>&lt;P&gt;I think the solution is that I will have to change the column name to adhere to sas naming conventions like the import&amp;nbsp; wizard in EG does with 'Rename columns to comply with sas naming conventions' option .&amp;nbsp; I am unable to figure out how I can do this with data step .&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2021 07:48:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-csv-file-with-columns-containing-special-characters/m-p/720847#M223336</guid>
      <dc:creator>kaziumair</dc:creator>
      <dc:date>2021-02-22T07:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: Importing csv file with columns containing special characters and multiple delimiters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-csv-file-with-columns-containing-special-characters/m-p/720851#M223338</link>
      <description>&lt;P&gt;The variable names I wrote follow the SAS rules, so I don't think you need to rename them.&lt;/P&gt;
&lt;P&gt;If you wanna rename in data step,&amp;nbsp;rewrite variable name both after length and input&amp;nbsp;statement.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2021 08:24:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-csv-file-with-columns-containing-special-characters/m-p/720851#M223338</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2021-02-22T08:24:24Z</dc:date>
    </item>
  </channel>
</rss>

