<?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: data extraction from csv file to sas in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/data-extraction-from-csv-file-to-sas/m-p/633463#M77883</link>
    <description>&lt;P&gt;Sorry, there's one detail I forgot to mention. The document has more than 1000 lines but it only shows 100 lines.&lt;/P&gt;</description>
    <pubDate>Thu, 19 Mar 2020 23:24:44 GMT</pubDate>
    <dc:creator>ks94</dc:creator>
    <dc:date>2020-03-19T23:24:44Z</dc:date>
    <item>
      <title>data extraction from csv file to sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data-extraction-from-csv-file-to-sas/m-p/633455#M77880</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;Please I need your help with a problem I'm having.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have imported a csv file ... but there are some columns that are missing and also some lines . how to proceed in such a case. I must have 14 variables, but I only have three.&lt;BR /&gt;Thank you. Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my code is:&lt;/P&gt;&lt;P&gt;---------------------------------&lt;/P&gt;&lt;P&gt;proc import datafile="/folders/myfolders/Data_projet_AFRIQUE.csv"&lt;/P&gt;&lt;P&gt;out=Prep.AFRICA&lt;BR /&gt;&lt;BR /&gt;dbms=csv&lt;BR /&gt;replace;&lt;BR /&gt;getnames=yes;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;-------------------------&lt;/P&gt;&lt;P&gt;a picture of the file structure&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 557px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/37064i73DE6B97FB545A1B/image-dimensions/557x85?v=v2" width="557" height="85" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt; Thanks you.&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>Thu, 19 Mar 2020 23:03:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data-extraction-from-csv-file-to-sas/m-p/633455#M77880</guid>
      <dc:creator>ks94</dc:creator>
      <dc:date>2020-03-19T23:03:59Z</dc:date>
    </item>
    <item>
      <title>Re: data extraction from csv file to sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data-extraction-from-csv-file-to-sas/m-p/633456#M77881</link>
      <description>Show what the CSV file looks like. You posted a picture of some word processor table or spreadsheet. A CSV file is a text file.  Just copy and paste a the first few lines from the CSV file itself.  Do NOT open the CSV file with a spreadsheet program, that could change the data.</description>
      <pubDate>Thu, 19 Mar 2020 23:08:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data-extraction-from-csv-file-to-sas/m-p/633456#M77881</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-19T23:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: data extraction from csv file to sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data-extraction-from-csv-file-to-sas/m-p/633462#M77882</link>
      <description>&lt;P&gt;it's the label and 3 first lines of csv file&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;case&lt;/TD&gt;&lt;TD&gt;cc3&lt;/TD&gt;&lt;TD&gt;country&lt;/TD&gt;&lt;TD&gt;year&lt;/TD&gt;&lt;TD&gt;systemic_crisis&lt;/TD&gt;&lt;TD&gt;exch_usd&lt;/TD&gt;&lt;TD&gt;domestic_debt_in_default&lt;/TD&gt;&lt;TD&gt;sovereign_external_debt_default&lt;/TD&gt;&lt;TD&gt;gdp_weighted_default&lt;/TD&gt;&lt;TD&gt;inflation_annual_cpi&lt;/TD&gt;&lt;TD&gt;independence&lt;/TD&gt;&lt;TD&gt;currency_crises&lt;/TD&gt;&lt;TD&gt;inflation_crises&lt;/TD&gt;&lt;TD&gt;banking_crisis&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;45&lt;/TD&gt;&lt;TD&gt;NGA&lt;/TD&gt;&lt;TD&gt;Nigeria&lt;/TD&gt;&lt;TD&gt;2014&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;155,25&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;8,048&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;crisis&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;DZA&lt;/TD&gt;&lt;TD&gt;Algeria&lt;/TD&gt;&lt;TD&gt;1871&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0,052798&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;14,1491396&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;no_crisis&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;DZA&lt;/TD&gt;&lt;TD&gt;Algeria&lt;/TD&gt;&lt;TD&gt;1872&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0,052274&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;-3,71859297&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;no_crisis&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;thanks you.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Mar 2020 23:17:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data-extraction-from-csv-file-to-sas/m-p/633462#M77882</guid>
      <dc:creator>ks94</dc:creator>
      <dc:date>2020-03-19T23:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: data extraction from csv file to sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data-extraction-from-csv-file-to-sas/m-p/633463#M77883</link>
      <description>&lt;P&gt;Sorry, there's one detail I forgot to mention. The document has more than 1000 lines but it only shows 100 lines.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Mar 2020 23:24:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data-extraction-from-csv-file-to-sas/m-p/633463#M77883</guid>
      <dc:creator>ks94</dc:creator>
      <dc:date>2020-03-19T23:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: data extraction from csv file to sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data-extraction-from-csv-file-to-sas/m-p/633464#M77884</link>
      <description>&lt;P&gt;Don't open the .csv with Excel. Excel changes things.&lt;/P&gt;
&lt;P&gt;You could: If file not too big and data not confidential then just attach the file - else: create a copy of the file, open it with a text editor like Notepad, delete most of the lines, save and then attach the file here.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will give us your file as close to your actual data as possible.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Mar 2020 23:28:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data-extraction-from-csv-file-to-sas/m-p/633464#M77884</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-03-19T23:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: data extraction from csv file to sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data-extraction-from-csv-file-to-sas/m-p/633465#M77885</link>
      <description>&lt;P&gt;it's done!&lt;/P&gt;&lt;P&gt;it's in .txt&lt;/P&gt;</description>
      <pubDate>Thu, 19 Mar 2020 23:43:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data-extraction-from-csv-file-to-sas/m-p/633465#M77885</guid>
      <dc:creator>ks94</dc:creator>
      <dc:date>2020-03-19T23:43:37Z</dc:date>
    </item>
    <item>
      <title>Re: data extraction from csv file to sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data-extraction-from-csv-file-to-sas/m-p/633466#M77886</link>
      <description>&lt;P&gt;Looks like this is not a proper .csv Below works for the attached data.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import 
  datafile="/folders/myfolders/Data_projet_AFRIQUE.txt"
  out=Prep.AFRICA
  replace;
  getnames=yes;
  delimiter=';';
  guessingrows=max;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Mar 2020 00:02:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data-extraction-from-csv-file-to-sas/m-p/633466#M77886</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-03-20T00:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: data extraction from csv file to sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data-extraction-from-csv-file-to-sas/m-p/633477#M77890</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/317542"&gt;@ks94&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;it's done!&lt;/P&gt;
&lt;P&gt;it's in .txt&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Just PASTE the lines from the file into the box that opens when you click on the INSERT CODE icon (it now looks like &amp;lt; / &amp;gt;.&lt;/P&gt;
&lt;PRE&gt;case;cc3;country;year;systemic_crisis;exch_usd;domestic_debt_in_default;sovereign_external_debt_default;gdp_weighted_default;inflation_annual_cpi;independence;currency_crises;inflation_crises;banking_crisis
45;NGA;Nigeria;2014;1;155,25;0;0;0;8,048;1;0;0;crisis
1;DZA;Algeria;1871;0;0,052798;0;0;0;14,14913958;0;0;0;no_crisis
1;DZA;Algeria;1872;0;0,052274;0;0;0;-3,718592965;0;0;0;no_crisis
1;DZA;Algeria;1873;0;0,05168;0;0;0;11,20389701;0;0;0;no_crisis
1;DZA;Algeria;1874;0;0,051308;0;0;0;-3,848560701;0;0;0;no_crisis&lt;/PRE&gt;
&lt;P&gt;The file is NOT a Comma Separated Values file.&amp;nbsp; It is a delimited file with semi-colon as the delimiter.&amp;nbsp; The reason PROC IMPORT thought there were only three variables is because the maximum number of commas in any of the lines was 2.&amp;nbsp; Just tell PROC IMPORT what character to use as the delimiter.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2020 01:01:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data-extraction-from-csv-file-to-sas/m-p/633477#M77890</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-20T01:01:26Z</dc:date>
    </item>
  </channel>
</rss>

