<?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: Proc transpose, possibly other solution in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-possibly-other-solution/m-p/185998#M47227</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The dates will only go from June to December of the same year, at the longest.&amp;nbsp; I agree that this is not the best way to display the data but that is what is requested.&amp;nbsp; I would like to use arrays but am not very familiar.&amp;nbsp; I am updating the info with proc transpose but not getting it quite right, that's why I posted here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 27 Feb 2015 16:10:34 GMT</pubDate>
    <dc:creator>Steelers_In_DC</dc:creator>
    <dc:date>2015-02-27T16:10:34Z</dc:date>
    <item>
      <title>Proc transpose, possibly other solution</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-possibly-other-solution/m-p/185996#M47225</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It took me a while to get this data together and now it seems the clients display preference is going to be a huge undertaking.&amp;nbsp; I'm not sure if transpose will put this together easily or if there is another way to get this but here it goes, below is a small portion of a dataset, power_id is a unique identifier and it's sorted by power_id record_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is what I have:&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 1010px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="20" width="77"&gt;POWER_ID&lt;/TD&gt;&lt;TD width="97"&gt;RECORD_DATE&lt;/TD&gt;&lt;TD width="130"&gt;pid_default_reason&lt;/TD&gt;&lt;TD width="76"&gt;cure_count&lt;/TD&gt;&lt;TD width="208"&gt;ACCT_DISCLOSURE_STATUS_FLG&lt;/TD&gt;&lt;TD width="48"&gt;PD_CD&lt;/TD&gt;&lt;TD width="68"&gt;DEL_DAYS&lt;/TD&gt;&lt;TD width="231"&gt;ACCT_CURRENT_CHARGE_OFF_AMT&lt;/TD&gt;&lt;TD width="75"&gt;pass_date&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20"&gt;0000196162&lt;/TD&gt;&lt;TD align="right" class="xl64"&gt;06/30/2013&lt;/TD&gt;&lt;TD class="xl63"&gt;&lt;/TD&gt;&lt;TD align="right"&gt;3&lt;/TD&gt;&lt;TD class="xl63"&gt;P&lt;/TD&gt;&lt;TD class="xl63"&gt;**&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;0.00&lt;/TD&gt;&lt;TD class="xl64"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20"&gt;0000196162&lt;/TD&gt;&lt;TD align="right" class="xl64"&gt;07/31/2013&lt;/TD&gt;&lt;TD class="xl63"&gt;&lt;/TD&gt;&lt;TD align="right"&gt;4&lt;/TD&gt;&lt;TD class="xl63"&gt;P&lt;/TD&gt;&lt;TD class="xl63"&gt;**&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;0.00&lt;/TD&gt;&lt;TD class="xl64"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20"&gt;0000196162&lt;/TD&gt;&lt;TD align="right" class="xl64"&gt;08/31/2013&lt;/TD&gt;&lt;TD class="xl63"&gt;&lt;/TD&gt;&lt;TD align="right"&gt;5&lt;/TD&gt;&lt;TD class="xl63"&gt;P&lt;/TD&gt;&lt;TD class="xl63"&gt;**&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;0.00&lt;/TD&gt;&lt;TD class="xl64"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20"&gt;0000196162&lt;/TD&gt;&lt;TD align="right" class="xl64"&gt;09/30/2013&lt;/TD&gt;&lt;TD class="xl63"&gt;&lt;/TD&gt;&lt;TD align="right"&gt;6&lt;/TD&gt;&lt;TD class="xl63"&gt;P&lt;/TD&gt;&lt;TD class="xl63"&gt;**&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;0.00&lt;/TD&gt;&lt;TD align="right" class="xl64"&gt;09/30/2013&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've attached what I want because it didn't look very nice pasted.&amp;nbsp; I had to use a csv because the excel format was too large.&amp;nbsp; You'll notice there are different columns before and after September 2013.&amp;nbsp; Any help will be appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Feb 2015 14:57:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-possibly-other-solution/m-p/185996#M47225</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-02-27T14:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: Proc transpose, possibly other solution</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-possibly-other-solution/m-p/185997#M47226</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would question the reasoning behind transposing the data.&amp;nbsp; In your example you have four or five dates, what happens when you have 50, that would be 50 * 20 or so variables.&amp;nbsp; You are then talking about working with thousands of variables.&amp;nbsp; Whats the data to be used for?&amp;nbsp; If its for reporting, does anyone seriously scroll the window across in Excel to see all those 1000's of columns, I somehow doubt it.&amp;nbsp; If its for further analysis then the normalised structure would presumably be easier to work with.&amp;nbsp; There are several ways of reporting the data in chunks, which may be preferable, for instance having a sheet for each quarter with the data normalised.&amp;nbsp; Perhaps just blocking it out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If however you have looked at the above and it is still required, then you could transpose each variable using proc transpose, but its a bit long winded.&amp;nbsp; You could use arrays: &lt;/P&gt;&lt;P&gt;&lt;A href="http://www.ats.ucla.edu/stat/sas/modules/longtowide_data.htm" title="http://www.ats.ucla.edu/stat/sas/modules/longtowide_data.htm"&gt;SAS Learning Module: Reshaping data long to wide using the data step&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Which would shrink your code somewhat. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So its technically possible, but do you really want to go there?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Feb 2015 15:42:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-possibly-other-solution/m-p/185997#M47226</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-02-27T15:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: Proc transpose, possibly other solution</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-possibly-other-solution/m-p/185998#M47227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The dates will only go from June to December of the same year, at the longest.&amp;nbsp; I agree that this is not the best way to display the data but that is what is requested.&amp;nbsp; I would like to use arrays but am not very familiar.&amp;nbsp; I am updating the info with proc transpose but not getting it quite right, that's why I posted here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Feb 2015 16:10:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-possibly-other-solution/m-p/185998#M47227</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-02-27T16:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: Proc transpose, possibly other solution</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-possibly-other-solution/m-p/185999#M47228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, for the arrays, here is a small example.&amp;nbsp; abcd all get transposed up, {1} references the month 06, {2} references 07.&amp;nbsp; (am finished for the week now, so hope this helps.)&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile datalines dlm=",";&lt;/P&gt;&lt;P&gt;&amp;nbsp; input POWER_ID $ RECORD_DATE $ A B $ C D;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;0000196162,06/30/2013,3,P **,0,0.00&lt;/P&gt;&lt;P&gt;0000196162,07/31/2013,4,P **,0,0.00&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;data want (drop=a b c d);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by power_id;&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain _a1-_a2 _b1-_b2 _c1-_c2 _d1-_d2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array _a{2} 8.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array _b{2} $8.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array _c{2} 8.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array _d{2} 8.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select(substr(record_date,1,2));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; when("06") ind=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; when("07") ind=2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; _a{ind}=a;&lt;/P&gt;&lt;P&gt;&amp;nbsp; _b{ind}=b;&lt;/P&gt;&lt;P&gt;&amp;nbsp; _c{ind}=c;&lt;/P&gt;&lt;P&gt;&amp;nbsp; _d{ind}=d;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if last.power_id then output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Feb 2015 16:24:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-possibly-other-solution/m-p/185999#M47228</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-02-27T16:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: Proc transpose, possibly other solution</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-possibly-other-solution/m-p/186000#M47229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how about with the one ID variable per line and everything leading with date out to the right?&amp;nbsp; I'm trying that with multiple transposes but still not quite getting there.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Feb 2015 17:17:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-possibly-other-solution/m-p/186000#M47229</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-02-27T17:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: Proc transpose, possibly other solution</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-possibly-other-solution/m-p/186001#M47230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Something like the following comes close:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile cards dlm='09'x;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat power_id $10.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat record_date mmddyy10.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format record_date mmddyy10.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat pid_default_reason $1.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat cure_count 1.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat ACCT_DISCLOSURE_STATUS_FLG $1.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat PD_CD $2.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat DEL_DAYS 8.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat ACCT_CURRENT_CHARGE_OFF_AMT 8.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat pass_date mmddyy10.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format pass_date mmddyy10.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input POWER_ID RECORD_DATE default_reason cure_count&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ACCT_DISCLOSURE_STATUS_FLG PD_CD DEL_DAYS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ACCT_CURRENT_CHARGE_OFF_AMT pass_date;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;0000196162 06/30/2013 . 3 P ** 0 0.00&lt;/P&gt;&lt;P&gt;0000196162 07/31/2013 . 4 P ** 0 0.00&lt;/P&gt;&lt;P&gt;0000196162 08/31/2013 . 5 P ** 0 0.00&lt;/P&gt;&lt;P&gt;0000196162 09/30/2013 . 6 P ** 0 0.00 09/30/2013&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain ACCT_DISCLOSURE_STATUS_FLG PD_CD DEL_DAYS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ACCT_CURRENT_CHARGE_OFF_AMT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; default_reason cure_count;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have (drop=_:);&lt;/P&gt;&lt;P&gt;&amp;nbsp; format pass_date mmddyy10.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do until (last.power_id);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have (rename=(pass_date=_pass_date));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by power_id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if first.power_id then call missing(pass_date);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not missing(_pass_date) then pass_date=_pass_date;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do until (last.power_id);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have (rename=(pass_date=_pass_date));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by power_id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc transpose data=have out=tall ;&lt;/P&gt;&lt;P&gt; by power_id record_date;&lt;/P&gt;&lt;P&gt; var ACCT_DISCLOSURE_STATUS_FLG--cure_count;&lt;/P&gt;&lt;P&gt; copy pass_date;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc transpose data=tall out=want (where=(not missing(_name_)));&lt;/P&gt;&lt;P&gt; by power_id;&lt;/P&gt;&lt;P&gt; id _name_ record_date;&lt;/P&gt;&lt;P&gt; var col1;&lt;/P&gt;&lt;P&gt; copy pass_date;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set want (drop=_:);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data need;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set want (keep=pd_cd: rename=(pd_cd06_30_2013=pd_cd_06_30_2013&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pd_cd07_31_2013=pd_cd_07_31_2013&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pd_cd08_31_2013=pd_cd_08_31_2013&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pd_cd09_30_2013=pd_cd_09_30_2013 ));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set need;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Feb 2015 17:20:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-possibly-other-solution/m-p/186001#M47230</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-02-27T17:20:25Z</dc:date>
    </item>
  </channel>
</rss>

