<?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 Data management to create a line chart in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Data-management-to-create-a-line-chart/m-p/433810#M14984</link>
    <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a task which I couldn't tackle. I have a data set that includes patient's ID and several variables coding patient's outcome performance on different scales before, during and after an intervention. The grade of performance&amp;nbsp;is coded from 0 to 4. Performance outcomes are partially missing for some patients.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to build a line chart that shows the change in the &lt;STRONG&gt;percentage&lt;/STRONG&gt; of patients that have a &lt;STRONG&gt;performance grade 3 or 4&lt;/STRONG&gt; before, during and after the outcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data look like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data x;
input ID test1before test1during test1after test2before test2during test2after ... .. testNafter;
cards;
1 1 2 3 1 3 3 ... 3;
2 . 1 2 1 4 4 ... 4;
3 3 4 4 1 3 3 ... 2;
.
.
.
;
end;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I have a number of difficulties. I think the best way is to make a new data set that contains the percentage of performance grade 3 or 4 for a each test on before, during and after the intervention, but I did not find the right procedure. Such data set will look like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Test&amp;nbsp; &amp;nbsp; &amp;nbsp;Before&amp;nbsp; &amp;nbsp; &amp;nbsp;During&amp;nbsp; &amp;nbsp; &amp;nbsp;After&lt;/P&gt;&lt;P&gt;Test1&amp;nbsp; &amp;nbsp;30%&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 55%&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 50%&lt;/P&gt;&lt;P&gt;Test2&amp;nbsp; &amp;nbsp;20%&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;43%&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 38%&lt;/P&gt;&lt;P&gt;Test3&amp;nbsp; ....&lt;/P&gt;&lt;P&gt;Test N&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The percentage need to be calculated after excluding missing values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 03 Feb 2018 16:32:23 GMT</pubDate>
    <dc:creator>Ubai</dc:creator>
    <dc:date>2018-02-03T16:32:23Z</dc:date>
    <item>
      <title>Data management to create a line chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Data-management-to-create-a-line-chart/m-p/433810#M14984</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a task which I couldn't tackle. I have a data set that includes patient's ID and several variables coding patient's outcome performance on different scales before, during and after an intervention. The grade of performance&amp;nbsp;is coded from 0 to 4. Performance outcomes are partially missing for some patients.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to build a line chart that shows the change in the &lt;STRONG&gt;percentage&lt;/STRONG&gt; of patients that have a &lt;STRONG&gt;performance grade 3 or 4&lt;/STRONG&gt; before, during and after the outcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data look like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data x;
input ID test1before test1during test1after test2before test2during test2after ... .. testNafter;
cards;
1 1 2 3 1 3 3 ... 3;
2 . 1 2 1 4 4 ... 4;
3 3 4 4 1 3 3 ... 2;
.
.
.
;
end;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I have a number of difficulties. I think the best way is to make a new data set that contains the percentage of performance grade 3 or 4 for a each test on before, during and after the intervention, but I did not find the right procedure. Such data set will look like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Test&amp;nbsp; &amp;nbsp; &amp;nbsp;Before&amp;nbsp; &amp;nbsp; &amp;nbsp;During&amp;nbsp; &amp;nbsp; &amp;nbsp;After&lt;/P&gt;&lt;P&gt;Test1&amp;nbsp; &amp;nbsp;30%&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 55%&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 50%&lt;/P&gt;&lt;P&gt;Test2&amp;nbsp; &amp;nbsp;20%&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;43%&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 38%&lt;/P&gt;&lt;P&gt;Test3&amp;nbsp; ....&lt;/P&gt;&lt;P&gt;Test N&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The percentage need to be calculated after excluding missing values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Feb 2018 16:32:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Data-management-to-create-a-line-chart/m-p/433810#M14984</guid>
      <dc:creator>Ubai</dc:creator>
      <dc:date>2018-02-03T16:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: Data management to create a line chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Data-management-to-create-a-line-chart/m-p/434259#M15004</link>
      <description>&lt;P&gt;I might suggest the Test number be just that unless you have much more information involved than "Test1".&lt;/P&gt;
&lt;P&gt;The overall data for graphing is likely to look more like but you don't mention what your "line chart" should look like. What would the xaxis on your chart represent? The test number?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Test Period&amp;nbsp;&amp;nbsp; Value&lt;/P&gt;
&lt;P&gt;Test1 Before 30%&lt;/P&gt;
&lt;P&gt;Test1 During 55%&lt;/P&gt;
&lt;P&gt;Test1 After&amp;nbsp;&amp;nbsp;&amp;nbsp; 50%&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are asking for help on calculating percentages? What would the numerator and denominator be for the percentages?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note your cards statements are incorrect as you cannot have the ; ending them and the data step would end with Run, not end.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my guess as to what you might be attempting:&lt;/P&gt;
&lt;PRE&gt;Data x;
input ID before1 during1 after1 before2 during2 after2 ;
   array t before: during: after: ;
   /* create 1/0 coded values, mean will be decimal percentage*/
   do i= 1 to dim(t);
      t[i] = t[i] in (3,4);
   end;
   drop i;
cards;
1 1 2 3 1 3 3 
2 . 1 2 1 4 4 
3 3 4 4 1 3 3 
;
run;

proc summary data=x;
   var before: during: after: ;
   output out= xsum (drop=_type_ _freq_) mean=;
run;

data plot;
   set xsum;
   array b before: ;
   array d during: ;
   array a after:  ;
   do Test= 1 to dim(b);
      When='Before';
      Value=B[Test];
      output;
      when='During';
      value=D[Test];
      output;
      when='After';
      value=a[Test];
      output;
   end;
   keep test when value;
run;

proc sgplot data=plot;
   series x=test y=value /group=when;
   format value percent8.1;
run;
     
&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Feb 2018 17:09:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Data-management-to-create-a-line-chart/m-p/434259#M15004</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-02-05T17:09:04Z</dc:date>
    </item>
  </channel>
</rss>

