<?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: Basic Proc Report in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/934950#M367621</link>
    <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;I am trying to create a report and this only creates a data set.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;As you said, it's a basic report. You now have all the data you need to build it.&lt;/P&gt;</description>
    <pubDate>Mon, 08 Jul 2024 12:03:06 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2024-07-08T12:03:06Z</dc:date>
    <item>
      <title>Basic Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/934567#M367505</link>
      <description>&lt;P&gt;I'm trying to create a simple report and would like feedback on whether processing needs to happen within data steps or can be written within proc report. I'm providing a very simple dataset as an example. As well as a visual made in Excel with a description of how ideally I would like the report to look.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data example;
	input stats $4. count num;      
	cards;
Miss 1 1
Miss 2 4
Miss 3 2
Miss 4 2 
Miss . 4 
Min . 1
Max . 4
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAS.PNG" style="width: 789px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/98121iF900AC5C1428EDBB/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAS.PNG" alt="SAS.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2024 15:14:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/934567#M367505</guid>
      <dc:creator>mmm7</dc:creator>
      <dc:date>2024-07-03T15:14:24Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/934722#M367537</link>
      <description>&lt;P&gt;Here's to get you started:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data EXAMPLE;
  input STATS $4. COUNT NUM;      
  cards;
Miss 1 1
Miss 2 4
Miss 3 2
Miss 4 2 
Miss . 4 
Min  . 1
Max  . 4
run;

data WANT;
  if _N_=1 then do;
    set EXAMPLE(rename=(NUM=MISSNUM));
    where STATS='Miss' and COUNT=.;
  end;
  set EXAMPLE;
  if STATS='Miss' and  COUNT and NUM =MISSNUM then COLOR='green ';
  if STATS='Miss' and  COUNT and NUM^=MISSNUM then COLOR='red   ';
  if STATS='Miss' and ^COUNT                  then COLOR='yellow';
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;TABLE class="table" style="border-spacing: 0;" aria-label="Data Set WORK.WANT"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="header" scope="col"&gt;STATS&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;COUNT&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;NUM&lt;/TH&gt;
&lt;TH class="header" scope="col"&gt;COLOR&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="data"&gt;Miss&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="data"&gt;red&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="data"&gt;Miss&lt;/TD&gt;
&lt;TD class="r data"&gt;2&lt;/TD&gt;
&lt;TD class="r data"&gt;4&lt;/TD&gt;
&lt;TD class="data"&gt;green&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="data"&gt;Miss&lt;/TD&gt;
&lt;TD class="r data"&gt;3&lt;/TD&gt;
&lt;TD class="r data"&gt;2&lt;/TD&gt;
&lt;TD class="data"&gt;red&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="data"&gt;Miss&lt;/TD&gt;
&lt;TD class="r data"&gt;4&lt;/TD&gt;
&lt;TD class="r data"&gt;2&lt;/TD&gt;
&lt;TD class="data"&gt;red&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="data"&gt;Miss&lt;/TD&gt;
&lt;TD class="r data"&gt;.&lt;/TD&gt;
&lt;TD class="r data"&gt;4&lt;/TD&gt;
&lt;TD class="data"&gt;yellow&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="data"&gt;Min&lt;/TD&gt;
&lt;TD class="r data"&gt;.&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="data"&gt;Max&lt;/TD&gt;
&lt;TD class="r data"&gt;.&lt;/TD&gt;
&lt;TD class="r data"&gt;4&lt;/TD&gt;
&lt;TD class="data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 23:54:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/934722#M367537</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2024-07-04T23:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/934945#M367618</link>
      <description>&lt;P&gt;Thank you for your reply though this is not the solution. I am trying to create a report and this only creates a data set.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2024 10:54:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/934945#M367618</guid>
      <dc:creator>mmm7</dc:creator>
      <dc:date>2024-07-08T10:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/934946#M367619</link>
      <description>&lt;P&gt;What have you tried?&lt;/P&gt;
&lt;P&gt;There are numerous paper explaining how to set background colours in proc report.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2024 11:23:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/934946#M367619</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2024-07-08T11:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/934950#M367621</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;I am trying to create a report and this only creates a data set.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;As you said, it's a basic report. You now have all the data you need to build it.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2024 12:03:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/934950#M367621</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2024-07-08T12:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/934951#M367622</link>
      <description>Great, if you can share syntax to create the report, as described, that would be helpful.</description>
      <pubDate>Mon, 08 Jul 2024 12:06:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/934951#M367622</guid>
      <dc:creator>mmm7</dc:creator>
      <dc:date>2024-07-08T12:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/934952#M367623</link>
      <description>Not going to post my syntax that did not produce the results I would like. I've read multiple papers. I'm looking for help on my post, not unhelpful comments. Thanks.</description>
      <pubDate>Mon, 08 Jul 2024 12:07:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/934952#M367623</guid>
      <dc:creator>mmm7</dc:creator>
      <dc:date>2024-07-08T12:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/934953#M367624</link>
      <description>&lt;P&gt;How about this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data example;
	input stats $4. count num;      
	cards;
Miss 1 1
Miss 2 4
Miss 3 2
Miss 4 2 
Miss . 4 
Min . 1
Max . 4
;
run;

ods listing close;
ods excel file='c:\temp\test.xlsx';
data WANT;
  if _N_=1 then do;
    set EXAMPLE(rename=(NUM=MISSNUM));
    where STATS='Miss' and COUNT=.;
  end;
  set example;
run;

proc report data=want;
column stats count num missnum dummy;
define stats / display;
define count / display;
define num / display;
define missnum / display;
define dummy / computed noprint;

compute dummy;
if STATS='Miss' and COUNT=. then 
 call define(_row_,'style','style=[backgroundcolor=yellow]');
else if stats='Miss' and count and NUM =MISSNUM then 
 call define('_c3_','style','style=[backgroundcolor=green]');
else if stats='Miss' and count and NUM ne MISSNUM then 
 call define('_c3_','style','style=[backgroundcolor=red]');
endcomp;
run;

ods excel close;
ods listing;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Jul 2024 12:16:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/934953#M367624</guid>
      <dc:creator>Kathryn_SAS</dc:creator>
      <dc:date>2024-07-08T12:16:24Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/934955#M367625</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; If you're going to put the color variable and the MISSNUM variable in a dataset, then it will be fairly easy to write the PROC REPORT code to do the highlighting as you show. The challenge is going to come in when you want to add the break lines. PROC REPORT will not arbitrarily insert blank lines into a report. PROC REPORT can only insert break lines at a break between group or order variables. So, the issue with what you show is that you are going to need some helper variables to do break processing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; However, you do not need to create a separate color variable in the dataset, but you will need to create a separate ordering/breaking variable. In my approach, I used a global macro variable to hold the value of MISSNUM=4 and then used that macro variable in the PROC REPORT COMPUTE block.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Note that I also used an extra variable called ORDVAR in the original data creation program to ensure the order of the rows so that you could use a LINE statement to insert the blank line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Here's an example of the ORDVAR helper variable I used:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data fakedata;
    length stats $4;
    infile datalines dlm=',' dsd;
	input ordvar $ stats $ count num;   
    if stats = 'Miss' and Count = . then do;
       call symputx('wantnum',put(num,2.0),'G');
    end; 
	cards;
A,Miss,1,1
A,Miss,2,4
A,Miss,3,2
A,Miss,4,2
B,Miss,.,4
C,Min,.,1
C,Max,.,4
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; Then having the macro variable and the helper variable ORDVAR allowed me to run this PROC REPORT:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1720441469329.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/98206i5FE0FA91367B904A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1720441469329.png" alt="Cynthia_sas_0-1720441469329.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2024 12:26:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/934955#M367625</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2024-07-08T12:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/934958#M367626</link>
      <description>Very helpful! Is there a way to suppress the MISSNUM column from appearing on the report? Or does it need to be present in order to produce the expected results?</description>
      <pubDate>Mon, 08 Jul 2024 12:48:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/934958#M367626</guid>
      <dc:creator>mmm7</dc:creator>
      <dc:date>2024-07-08T12:48:14Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/934960#M367627</link>
      <description>&lt;P&gt;You can add the NOPRINT option as follows:&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;define missnum / display;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;define missnum&amp;nbsp; / display noprint;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2024 12:52:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/934960#M367627</guid>
      <dc:creator>Kathryn_SAS</dc:creator>
      <dc:date>2024-07-08T12:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/935124#M367666</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;I'm looking for help on my post, not unhelpful comments.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;People in this community are volunteering their time and competence to guide you and help you solve your problems, so you can learn. Not to solve your problems for you. So more gratefulness and more gracefulness would be appropriate. &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt; is one of 65 super users, the community's most helpful experts. Please keep this in mind. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 12:19:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/935124#M367666</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2024-07-09T12:19:23Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/935143#M367677</link>
      <description>aha! I was using the noprint but not...display noprint. Thank you for responding. Your comments were very helpful and I was able to produce a beautiful report!</description>
      <pubDate>Tue, 09 Jul 2024 12:33:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/935143#M367677</guid>
      <dc:creator>mmm7</dc:creator>
      <dc:date>2024-07-09T12:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/935144#M367678</link>
      <description>&lt;P&gt;I very much appreciate when members provide helpful comments., as both&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13770"&gt;@Kathryn_SAS&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13549"&gt;@Cynthia_sas&lt;/a&gt; did. Thank you!!&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 12:38:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basic-Proc-Report/m-p/935144#M367678</guid>
      <dc:creator>mmm7</dc:creator>
      <dc:date>2024-07-09T12:38:19Z</dc:date>
    </item>
  </channel>
</rss>

