<?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: Retain or lag the values as desired in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Retain-or-lag-the-values-as-desired/m-p/820770#M324012</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294544"&gt;@RAVI2000&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data = have out=want prefix=_;
by&amp;nbsp;trt&amp;nbsp;subject&amp;nbsp;test&amp;nbsp;descending&amp;nbsp;grade;&lt;BR /&gt;var&amp;nbsp;grade;&lt;BR /&gt;id&amp;nbsp;test;&lt;BR /&gt;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That's not the code I provided. In fact the code I provided seems to work perfectly on your data.&lt;/P&gt;</description>
    <pubDate>Tue, 28 Jun 2022 19:07:35 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-06-28T19:07:35Z</dc:date>
    <item>
      <title>Retain or lag the values as desired</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retain-or-lag-the-values-as-desired/m-p/820755#M324006</link>
      <description>&lt;P&gt;Hi all,&lt;BR /&gt;Looking to manage my data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HAVE:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RAVI2000_0-1656439188605.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/72783i0C26B6E506CE072D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RAVI2000_0-1656439188605.png" alt="RAVI2000_0-1656439188605.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;want:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RAVI2000_1-1656439217837.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/72784iF1096050DFBE6EDB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RAVI2000_1-1656439217837.png" alt="RAVI2000_1-1656439217837.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2022 18:00:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retain-or-lag-the-values-as-desired/m-p/820755#M324006</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2022-06-28T18:00:45Z</dc:date>
    </item>
    <item>
      <title>Re: Retain or lag the values as desired</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retain-or-lag-the-values-as-desired/m-p/820756#M324007</link>
      <description>&lt;P&gt;Please explain:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;What happened to trt 1 subject 1 in your output?&lt;/LI&gt;
&lt;LI&gt;Why are some cells in the output blank and others have a dash?&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Other than those issues, this is really just a PROC TRANSPOSE with BY statement — although depending on what analysis you will do next, you might want to leave the data un-transposed. So what analysis are you going to do next?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;UNTESTED CODE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=have out=want;
    by trt subject;
    var grade;
    id test;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then you can turn the zeros into spaces or dashes as desired.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want tested code, and for all questions you might ask in the future, we cannot use data in a screen capture. Provide data as SAS data step code, which you can type yourself, or you can follow &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;these instructions&lt;/A&gt;. Consider this mandatory in the future, data only as SAS data step code, not screen captures, not Excel files.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2022 18:18:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retain-or-lag-the-values-as-desired/m-p/820756#M324007</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-06-28T18:18:40Z</dc:date>
    </item>
    <item>
      <title>Re: Retain or lag the values as desired</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retain-or-lag-the-values-as-desired/m-p/820759#M324008</link>
      <description>&lt;P&gt;Thank you &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt; for the input. &lt;BR /&gt;I would only like to populate values who have grades. For the trt 1, there are no grades. &lt;BR /&gt;I have used the above code and It is giving me like below:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RAVI2000_0-1656440380474.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/72785i5C1E084B6D7B7DDE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RAVI2000_0-1656440380474.png" alt="RAVI2000_0-1656440380474.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2022 18:20:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retain-or-lag-the-values-as-desired/m-p/820759#M324008</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2022-06-28T18:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: Retain or lag the values as desired</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retain-or-lag-the-values-as-desired/m-p/820761#M324009</link>
      <description>&lt;P&gt;Please provide the data as SAS data step code, as I requested.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Also, please show the exact code you used.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2022 18:21:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retain-or-lag-the-values-as-desired/m-p/820761#M324009</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-06-28T18:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: Retain or lag the values as desired</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retain-or-lag-the-values-as-desired/m-p/820762#M324010</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input trt subject test 3$ grade;
cards;
1 1  ALT  0
1 1  AST  0
1 1  BILI 0
1 1  GGT  0
1 3  ALT  0
1 3  AST  0
1 3  BILI 1
1 3  GGT  2
2 4  ALT  1
2 4  AST  0
2 4  BILI 0
2 4  GGT  0
2 5  ALT  0
2 5  AST  2
2 5  BILI 0
2 5  GGT  3
3 6  ALT  0
3 6  AST  0
3 6  BILI 0
3 6  GGT  1
3 10 ALT  0
3 10 AST  4
3 10 BILI 1
3 10 GGT  0
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Jun 2022 18:25:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retain-or-lag-the-values-as-desired/m-p/820762#M324010</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2022-06-28T18:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: Retain or lag the values as desired</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retain-or-lag-the-values-as-desired/m-p/820764#M324011</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data = have out=want prefix=_;
by&amp;nbsp;trt&amp;nbsp;subject&amp;nbsp;test&amp;nbsp;descending&amp;nbsp;grade;&lt;BR /&gt;var&amp;nbsp;grade;&lt;BR /&gt;id&amp;nbsp;test;&lt;BR /&gt;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Jun 2022 18:30:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retain-or-lag-the-values-as-desired/m-p/820764#M324011</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2022-06-28T18:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: Retain or lag the values as desired</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retain-or-lag-the-values-as-desired/m-p/820770#M324012</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294544"&gt;@RAVI2000&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data = have out=want prefix=_;
by&amp;nbsp;trt&amp;nbsp;subject&amp;nbsp;test&amp;nbsp;descending&amp;nbsp;grade;&lt;BR /&gt;var&amp;nbsp;grade;&lt;BR /&gt;id&amp;nbsp;test;&lt;BR /&gt;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That's not the code I provided. In fact the code I provided seems to work perfectly on your data.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2022 19:07:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retain-or-lag-the-values-as-desired/m-p/820770#M324012</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-06-28T19:07:35Z</dc:date>
    </item>
  </channel>
</rss>

