<?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: transpose in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/transpose/m-p/420276#M103410</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You maybe missing another by variable here.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Dec 2017 20:27:42 GMT</pubDate>
    <dc:creator>SuryaKiran</dc:creator>
    <dc:date>2017-12-11T20:27:42Z</dc:date>
    <item>
      <title>transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/transpose/m-p/420246#M103397</link>
      <description>&lt;P&gt;Hello0-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I'm trying to transpose a variable called gcs, because there are two values per patient. I used the following code:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;sort&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;data&lt;/SPAN&gt;=pc.trpenmr1; &lt;SPAN&gt;by&lt;/SPAN&gt; accountNum; &lt;SPAN&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;transpose&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;data&lt;/SPAN&gt; = pc.trpenmr1 &lt;SPAN&gt;out&lt;/SPAN&gt;=pc.gcs (drop=_name_) &lt;SPAN&gt;prefix&lt;/SPAN&gt;=GCS;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;by&lt;/SPAN&gt; accountnum;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; gcs ;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm getting this (see attached screenshot)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I really only want it to say GCS1, GCS 2, per accountnum. How do I clean this up?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 19:05:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/transpose/m-p/420246#M103397</guid>
      <dc:creator>stancemcgraw</dc:creator>
      <dc:date>2017-12-11T19:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/transpose/m-p/420253#M103400</link>
      <description>&lt;P&gt;I&amp;nbsp; don't think you posted the attachment&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 19:17:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/transpose/m-p/420253#M103400</guid>
      <dc:creator>antonbcristina</dc:creator>
      <dc:date>2017-12-11T19:17:21Z</dc:date>
    </item>
    <item>
      <title>Re: transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/transpose/m-p/420269#M103405</link>
      <description />
      <pubDate>Mon, 11 Dec 2017 20:19:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/transpose/m-p/420269#M103405</guid>
      <dc:creator>stancemcgraw</dc:creator>
      <dc:date>2017-12-11T20:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/transpose/m-p/420271#M103406</link>
      <description>&lt;P&gt;How's is it filling in 4, 5, 6, 7 if you dont have multiples?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please post some sample data that will replicate this issue, if you can't include your real data make some fake data that mimics your data. If you could rotate your images before posting that's helpful as well....it's hard to read data when it's sideways.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 20:21:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/transpose/m-p/420271#M103406</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-12-11T20:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/transpose/m-p/420275#M103409</link>
      <description>Ok.So you are correct there are a few values for each, but I'd like to only collect the first and last...</description>
      <pubDate>Mon, 11 Dec 2017 20:27:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/transpose/m-p/420275#M103409</guid>
      <dc:creator>stancemcgraw</dc:creator>
      <dc:date>2017-12-11T20:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/transpose/m-p/420276#M103410</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You maybe missing another by variable here.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 20:27:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/transpose/m-p/420276#M103410</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2017-12-11T20:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/transpose/m-p/420277#M103411</link>
      <description>&lt;P&gt;this is what it looks like prior to transpose&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 20:28:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/transpose/m-p/420277#M103411</guid>
      <dc:creator>stancemcgraw</dc:creator>
      <dc:date>2017-12-11T20:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/transpose/m-p/420279#M103412</link>
      <description>&lt;P&gt;Please check if this helps.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; data have;
input id num val;
datalines;
11 1 3
11 2 4
11 2 5
11 3 3
12 1 4
12 2 3
12 3 4
;
run;
proc sort data=have;
by id num;
run;
proc transpose data=have(where=(val in (3,4))) out=want(drop=_name_) prefix=col;
by id num;
id val;
var val;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Dec 2017 20:44:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/transpose/m-p/420279#M103412</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2017-12-11T20:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/transpose/m-p/420280#M103413</link>
      <description>&lt;P&gt;Then you first need to use FIRST and LAST to remove keep only the records of interest.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then apply the PROC TRANSPOSE.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want a more detailed answer, such as sample code, please provide sample data in text format. We can't write and test a program based of images unless we type in the data....&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 20:45:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/transpose/m-p/420280#M103413</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-12-11T20:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/transpose/m-p/420284#M103414</link>
      <description>&lt;P&gt;Hopefully, you have another copy of the original data, because your proc sort destroyed the ordering of records in your origninal dataset. If you do have another copy, and your data are like that shown in the pdf you posted, then you could use something like the following:&lt;/P&gt;
&lt;PRE&gt;libname pc '/folders/myfolders';
data pc.trpenmr1;
  input (MRN AccountNum) ($) GCS;
  cards;
RM13270173 RA0001998090 13
. . 13

RM13311641 RA0001998675 15
. . 15

RM13311782 RA000199723 14
. . 14
. . 15
;

data need (drop=_:);
  set pc.trpenmr1 (rename=(MRN=_MRN AccountNum=_AccountNUM));
  retain MRN AccountNum;
  if not missing(_MRN) then do;
    MRN=_MRN;
    AccountNum=_AccountNum;
    output;
  end;
  else if not missing(GCS)then output;
run;

proc sort data=need out=pc.trpenmr2;
  by MRN AccountNum;
run;

data pc.trpenmr2;
  set pc.trpenmr2;
  by MRN AccountNum;
  if first.MRN or last.MRN;
run;

proc transpose data = pc.trpenmr2 out=pc.gcs (drop=_name_) prefix=GCS;
  by MRN Accountnum;
  var gcs ;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 20:58:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/transpose/m-p/420284#M103414</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-12-11T20:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/transpose/m-p/420532#M103506</link>
      <description>&lt;P&gt;that worked thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 17:29:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/transpose/m-p/420532#M103506</guid>
      <dc:creator>stancemcgraw</dc:creator>
      <dc:date>2017-12-12T17:29:52Z</dc:date>
    </item>
  </channel>
</rss>

