<?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 Converting a csv file to a sas table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Converting-a-csv-file-to-a-sas-table/m-p/834436#M329901</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to convert a csv file to a SAS table using the code below:&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= work.scores
     datafile ="c:/mydir/scores_*.csv"
     dbms=csv
     replace;
     delimiter="|";
     getnames=YES;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However the first column of my file is not giving the correct value in the table&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CSV FILE:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MILKYLOVE_0-1663753003892.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75423iFBF5D01D285B354D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MILKYLOVE_0-1663753003892.png" alt="MILKYLOVE_0-1663753003892.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MILKYLOVE_1-1663753151998.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75424i1D337465BF507103/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MILKYLOVE_1-1663753151998.png" alt="MILKYLOVE_1-1663753151998.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me to get the number right.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Sep 2022 09:39:33 GMT</pubDate>
    <dc:creator>MILKYLOVE</dc:creator>
    <dc:date>2022-09-21T09:39:33Z</dc:date>
    <item>
      <title>Converting a csv file to a sas table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-a-csv-file-to-a-sas-table/m-p/834436#M329901</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to convert a csv file to a SAS table using the code below:&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= work.scores
     datafile ="c:/mydir/scores_*.csv"
     dbms=csv
     replace;
     delimiter="|";
     getnames=YES;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However the first column of my file is not giving the correct value in the table&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CSV FILE:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MILKYLOVE_0-1663753003892.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75423iFBF5D01D285B354D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MILKYLOVE_0-1663753003892.png" alt="MILKYLOVE_0-1663753003892.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MILKYLOVE_1-1663753151998.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75424i1D337465BF507103/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MILKYLOVE_1-1663753151998.png" alt="MILKYLOVE_1-1663753151998.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me to get the number right.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 09:39:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-a-csv-file-to-a-sas-table/m-p/834436#M329901</guid>
      <dc:creator>MILKYLOVE</dc:creator>
      <dc:date>2022-09-21T09:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: Converting a csv file to a sas table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-a-csv-file-to-a-sas-table/m-p/834454#M329905</link>
      <description>&lt;P&gt;The data you have posted is a perfect demonstration why relying on proc import is a bad idea. Instead of reading the first variable as char, the contents of the variable causes sas to set the wrong type. So: don't use proc import write a data step yourself.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Untested:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.scores;
  infile "C:/mydir/scores_*.csv" delimiter= "|" firstobs= 2 missover;
  length 
    number $14 
    dab rc construction flotte snt_col pre_col $ 1
    activities $ 200
  ;
  input number -- activities;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want to see the real contents of a csv file, open it using a text editor, not Excel.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 12:06:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-a-csv-file-to-a-sas-table/m-p/834454#M329905</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-09-21T12:06:15Z</dc:date>
    </item>
  </channel>
</rss>

