<?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: Import a csv file into SAS and then convert it into a panel dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Import-a-csv-file-into-SAS-and-then-convert-it-into-a-panel/m-p/659112#M197496</link>
    <description>&lt;P&gt;I might try something along these lines:&lt;/P&gt;
&lt;PRE&gt;data want;
   infile "path and filename.csv" dlm=',';
   informat dummy $1.;
   input year
         /dummy variable_a
         /dummy variable_b
         /dummy variable_c
         /dummy variable_d
   ;
   drop dummy;
run;
&lt;/PRE&gt;
&lt;P&gt;The / in the input statement this way says "read from next line". The Dummy variable holds a not needed part of the "variable name". If your data does not change in order as implied by your example and always has 4 lines of variable a to d then this should read the data into that form.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your data was manually entered into Excel then stop it if you want "panel" data like this.&lt;/P&gt;</description>
    <pubDate>Mon, 15 Jun 2020 19:58:02 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-06-15T19:58:02Z</dc:date>
    <item>
      <title>Import a csv file into SAS and then convert it into a panel dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-a-csv-file-into-SAS-and-then-convert-it-into-a-panel/m-p/659078#M197479</link>
      <description>&lt;P&gt;Hello everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to analyze changes in unemployment rate in a city over time (2000 - 2020) using SAS. A state government website reports unemployment rate data by city between 2000 and 2020 - please see the attached file for a snapshot (sheet 1: "Import_Unemployment").&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to import the csv file and then to be able to convert it into a SAS dataset which looks like "Desirable Output" in the second sheet, i.e., panel dataset. I have tried using proc import and other techniques but none worked. Does anybody know how to figure this out?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would be grateful if you could provide me with any tips regarding this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kishiyo&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 18:33:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-a-csv-file-into-SAS-and-then-convert-it-into-a-panel/m-p/659078#M197479</guid>
      <dc:creator>kishiyo</dc:creator>
      <dc:date>2020-06-15T18:33:57Z</dc:date>
    </item>
    <item>
      <title>Re: Import a csv file into SAS and then convert it into a panel dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-a-csv-file-into-SAS-and-then-convert-it-into-a-panel/m-p/659085#M197483</link>
      <description>&lt;P&gt;When you need help importing a CSV file, you need to post&amp;nbsp;&lt;EM&gt;that&lt;/EM&gt;, not the Excel representation, which is useless.&lt;/P&gt;
&lt;P&gt;It is usually sufficient to open the csv file with an editor (not with Excel!), and copy/paste the first few lines into a window opened with the &amp;lt;/&amp;gt; button.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 18:52:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-a-csv-file-into-SAS-and-then-convert-it-into-a-panel/m-p/659085#M197483</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-15T18:52:17Z</dc:date>
    </item>
    <item>
      <title>Re: Import a csv file into SAS and then convert it into a panel dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-a-csv-file-into-SAS-and-then-convert-it-into-a-panel/m-p/659112#M197496</link>
      <description>&lt;P&gt;I might try something along these lines:&lt;/P&gt;
&lt;PRE&gt;data want;
   infile "path and filename.csv" dlm=',';
   informat dummy $1.;
   input year
         /dummy variable_a
         /dummy variable_b
         /dummy variable_c
         /dummy variable_d
   ;
   drop dummy;
run;
&lt;/PRE&gt;
&lt;P&gt;The / in the input statement this way says "read from next line". The Dummy variable holds a not needed part of the "variable name". If your data does not change in order as implied by your example and always has 4 lines of variable a to d then this should read the data into that form.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your data was manually entered into Excel then stop it if you want "panel" data like this.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 19:58:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-a-csv-file-into-SAS-and-then-convert-it-into-a-panel/m-p/659112#M197496</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-06-15T19:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: Import a csv file into SAS and then convert it into a panel dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-a-csv-file-into-SAS-and-then-convert-it-into-a-panel/m-p/659115#M197497</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC IMPORT OUT= WORK.Test 
            DATAFILE= "&amp;lt;your csv file along with path&amp;gt;" 
            DBMS=CSV REPLACE;
     GETNAMES=YES;
     DATAROW=2; 
RUN;

data new;
set test;
retain year;
Value2=input(tranwrd(value,'%',''),best12.);
if anyalpha(var1)=0 then year=var1;;
if anyalpha(var1)&amp;gt;0 then output;
run;

proc sort data=new;
by year;

proc transpose data=new out=newt(drop = _name_);
by year;
var value2;
id var1;
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 20:19:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-a-csv-file-into-SAS-and-then-convert-it-into-a-panel/m-p/659115#M197497</guid>
      <dc:creator>smantha</dc:creator>
      <dc:date>2020-06-15T20:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: Import a csv file into SAS and then convert it into a panel dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-a-csv-file-into-SAS-and-then-convert-it-into-a-panel/m-p/659139#M197511</link>
      <description>&lt;P&gt;Dear Ballardw,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help! I found your examples very helpful.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kishiyo.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 21:37:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-a-csv-file-into-SAS-and-then-convert-it-into-a-panel/m-p/659139#M197511</guid>
      <dc:creator>kishiyo</dc:creator>
      <dc:date>2020-06-15T21:37:54Z</dc:date>
    </item>
    <item>
      <title>Re: Import a csv file into SAS and then convert it into a panel dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-a-csv-file-into-SAS-and-then-convert-it-into-a-panel/m-p/659140#M197512</link>
      <description>Dear Smantha,&lt;BR /&gt;&lt;BR /&gt;Thank you so much - it worked very well. I appreciate your timely response and help.&lt;BR /&gt;&lt;BR /&gt;Kishiyo</description>
      <pubDate>Mon, 15 Jun 2020 21:38:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-a-csv-file-into-SAS-and-then-convert-it-into-a-panel/m-p/659140#M197512</guid>
      <dc:creator>kishiyo</dc:creator>
      <dc:date>2020-06-15T21:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: Import a csv file into SAS and then convert it into a panel dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-a-csv-file-into-SAS-and-then-convert-it-into-a-panel/m-p/659142#M197513</link>
      <description>Dear KurtBremser,&lt;BR /&gt;&lt;BR /&gt;Thank you for your quick response and also for suggestion. I will be more concise in the future when I seek for assistance.&lt;BR /&gt;&lt;BR /&gt;Kishiyo</description>
      <pubDate>Mon, 15 Jun 2020 21:39:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-a-csv-file-into-SAS-and-then-convert-it-into-a-panel/m-p/659142#M197513</guid>
      <dc:creator>kishiyo</dc:creator>
      <dc:date>2020-06-15T21:39:48Z</dc:date>
    </item>
  </channel>
</rss>

