<?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: How to transform the columns into rows by using external csv file? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-transform-the-columns-into-rows-by-using-external-csv/m-p/113472#M31417</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you may use the command below to transform the file. But first you have to import the .csv file into SAS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC TRANSPOSE &amp;lt;DATA=input-data-set&amp;gt; &lt;/P&gt;&lt;P&gt; &amp;lt;DELIMITER=delimiter&amp;gt; &lt;/P&gt;&lt;P&gt; &amp;lt;LABEL=label&amp;gt; &lt;/P&gt;&lt;P&gt; &amp;lt;LET&amp;gt; &lt;/P&gt;&lt;P&gt; &amp;lt;NAME=name&amp;gt; &lt;/P&gt;&lt;P&gt; &amp;lt;OUT=output-data-set&amp;gt; &lt;/P&gt;&lt;P&gt; &amp;lt;PREFIX=prefix&amp;gt; &lt;/P&gt;&lt;P&gt; &amp;lt;SUFFIX=suffix&amp;gt;; &lt;/P&gt;&lt;P&gt;BY &amp;lt;DESCENDING&amp;gt; variable-1&lt;/P&gt;&lt;P&gt; &amp;lt;...&amp;lt;DESCENDING&amp;gt; variable-n&amp;gt;; &lt;/P&gt;&lt;P&gt;COPY variable(s); &lt;/P&gt;&lt;P&gt;ID variable; &lt;/P&gt;&lt;P&gt;IDLABEL variable; &lt;/P&gt;&lt;P&gt;VAR variable(s);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 08 Jul 2013 13:25:12 GMT</pubDate>
    <dc:creator>yifengwan</dc:creator>
    <dc:date>2013-07-08T13:25:12Z</dc:date>
    <item>
      <title>How to transform the columns into rows by using external csv file?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-transform-the-columns-into-rows-by-using-external-csv/m-p/113470#M31415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;Please find the below screen shot&lt;/SPAN&gt;, &lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;In particular, all the columns G to the end are the same.&amp;nbsp; I need to transform the columns into rows.&amp;nbsp; For each row read in, I need t&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;o output a row for each column (&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;G-the end).&amp;nbsp; I then need to convert each file back into a CSV&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;It should be "If units &amp;gt; 0 then Output" to only &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;create rows for cells with data .So please kindly advise how to proceed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;Thanks &amp;amp; Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;Praveen&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;IMG alt="" class="jiveImage" src="https://communities.sas.com/legacyfs/online/3728_pastedImage_3.png" style="width: 1024px; height: 742px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;The final output should be in below format&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;IMG alt="" class="jiveImage" src="https://communities.sas.com/legacyfs/online/3729_pastedImage_4.png" style="width: 1024px; height: 742px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jun 2013 12:42:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-transform-the-columns-into-rows-by-using-external-csv/m-p/113470#M31415</guid>
      <dc:creator>Praveen_G</dc:creator>
      <dc:date>2013-06-20T12:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to transform the columns into rows by using external csv file?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-transform-the-columns-into-rows-by-using-external-csv/m-p/113471#M31416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you please copy the data in the csv file using notepad?&amp;nbsp; I am not prepared to retype the screenshots you have attached.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jul 2013 12:40:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-transform-the-columns-into-rows-by-using-external-csv/m-p/113471#M31416</guid>
      <dc:creator>Scott_Mitchell</dc:creator>
      <dc:date>2013-07-08T12:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to transform the columns into rows by using external csv file?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-transform-the-columns-into-rows-by-using-external-csv/m-p/113472#M31417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you may use the command below to transform the file. But first you have to import the .csv file into SAS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC TRANSPOSE &amp;lt;DATA=input-data-set&amp;gt; &lt;/P&gt;&lt;P&gt; &amp;lt;DELIMITER=delimiter&amp;gt; &lt;/P&gt;&lt;P&gt; &amp;lt;LABEL=label&amp;gt; &lt;/P&gt;&lt;P&gt; &amp;lt;LET&amp;gt; &lt;/P&gt;&lt;P&gt; &amp;lt;NAME=name&amp;gt; &lt;/P&gt;&lt;P&gt; &amp;lt;OUT=output-data-set&amp;gt; &lt;/P&gt;&lt;P&gt; &amp;lt;PREFIX=prefix&amp;gt; &lt;/P&gt;&lt;P&gt; &amp;lt;SUFFIX=suffix&amp;gt;; &lt;/P&gt;&lt;P&gt;BY &amp;lt;DESCENDING&amp;gt; variable-1&lt;/P&gt;&lt;P&gt; &amp;lt;...&amp;lt;DESCENDING&amp;gt; variable-n&amp;gt;; &lt;/P&gt;&lt;P&gt;COPY variable(s); &lt;/P&gt;&lt;P&gt;ID variable; &lt;/P&gt;&lt;P&gt;IDLABEL variable; &lt;/P&gt;&lt;P&gt;VAR variable(s);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jul 2013 13:25:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-transform-the-columns-into-rows-by-using-external-csv/m-p/113472#M31417</guid>
      <dc:creator>yifengwan</dc:creator>
      <dc:date>2013-07-08T13:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to transform the columns into rows by using external csv file?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-transform-the-columns-into-rows-by-using-external-csv/m-p/113473#M31418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="817368" __jive_macro_name="user" class="jive_macro jive_macro_user" href="https://communities.sas.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;They are a couple unanswered questions that you dont really cover in your post. And your sample data and output doesnt really answer either, since the input does not match the outpu (ie Kansas output is listed as 76 while only 8 appear in the input).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are three codes for each input line ... so do you want each code to be on its own observation in the output with number of under the zipcode applied to each?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Im assuming the total variable on the input is not relevant to the output desired.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Im guessing you might have more challenging of time reading in your source if the screen shot is in fact the way the csv is structured (the first three rows are horizontally structured while the remaining are vertically structured).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you can provide more explanation and perhaps an actual sample input file it would help tailor the code to your actual situation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EJ&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jul 2013 13:51:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-transform-the-columns-into-rows-by-using-external-csv/m-p/113473#M31418</guid>
      <dc:creator>esjackso</dc:creator>
      <dc:date>2013-07-08T13:51:11Z</dc:date>
    </item>
  </channel>
</rss>

