<?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: How Can I Put The Correct Value in a Line Statment for a Compute Before in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-Can-I-Put-The-Correct-Value-in-a-Line-Statment-for-a-Compute/m-p/352300#M63996</link>
    <description>&lt;P&gt;Unfortunately it is a little difficult to execute with your posted code, given that line structure is important in datalines command. &amp;nbsp;Could you repost with the datalines restructured?&lt;/P&gt;</description>
    <pubDate>Fri, 21 Apr 2017 19:12:55 GMT</pubDate>
    <dc:creator>thomp7050</dc:creator>
    <dc:date>2017-04-21T19:12:55Z</dc:date>
    <item>
      <title>How Can I Put The Correct Value in a Line Statment for a Compute Before</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-Can-I-Put-The-Correct-Value-in-a-Line-Statment-for-a-Compute/m-p/352228#M63990</link>
      <description>&lt;P&gt;In a PROC REPORT I figured out how to insert a&amp;nbsp;sub-title row before a new group begins, but I cannot figure out out to get the correct group name into the sub-title.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Notice that in my output :&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;1st sub-title text is &lt;STRONG&gt;'Make&lt;/STRONG&gt;:'&lt;/LI&gt;&lt;LI&gt;2nd sub-title is &lt;STRONG&gt;'Make: Chevy'&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;It is supposed to be&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;1st sub-title&amp;nbsp;should&amp;nbsp;be &lt;STRONG&gt;'Make: Chevy'&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;2nd sub-title&amp;nbsp;should be &amp;nbsp;&lt;STRONG&gt;'Make: Ford'&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;My code is below, screen shot of output is attached&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code to create data for this example:&lt;/P&gt;&lt;PRE&gt;&lt;STRONG&gt;&lt;CODE class=" language-sas"&gt;data cars;
	infile datalines dlm=',';
	input makeNum make:$12. _BREAK_:$25. description:$50. retail myCost;
	datalines;
	1,Chevy, , Chevy-Impala-Red, 32000, 29000
	1,Chevy, , Chevy-Impala-Blue,32000, 29500
	1,Chevy,makeModel, Total: Chevy-Impala, 64000, 58500
	1,Chevy, , Chevy-Malibu-White, 28000, 26500
	1,Chevy,makeModel, Total: Chevy-Malibu, 28000, 26500
	1,Chevy,make, Total: Chevy,92000, 85000
	2,Ford, ,Ford-Fiesta-Silver,14000,12000
	2,Ford, ,Ford-Fiesta-Blue,14000,12000
	2,Ford,, ,Ford-Fiesta-Gold,14500,12000
	2,Ford,makeModel, Total: FordFiesta, 42500,36000
	2,Ford, ,Ford-Focus-Silver, 17000, 16000
	2,Ford, ,Ford-Focus-Blue,1700,15800
	2,Ford,makeModel, Total: Ford-Focus,34000,31800
	2,Ford,make, Total: Ford, 76500,67800
	, , _RBREAK_, TOTAL: ,168500,152800
	;
run;&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code for the report:&lt;/P&gt;&lt;PRE&gt;&lt;STRONG&gt;TITLE1 "List Report";
FOOTNOTE1 "Generated by the SAS System (&amp;amp;_SASSERVERNAME, &amp;amp;SYSSCPL) on %TRIM(%QSYSFUNC(DATE(), NLDATE20.)) at %TRIM(%SYSFUNC(TIME(), TIMEAMPM12.))";

proc report data=WORK.CARS nowd;
	column makeNum  make  _BREAK_ description retail  myCost;
	define makeNum /  group missing order=data noprint;	
	define make /group missing  order=data noprint;
	compute  make;
		if make ne ' ' then hold1=make;
		if make eq ' ' then make=hold1;
	endcomp;
	define _BREAK_ / display '_BREAK_' missing order=data noprint;
	define description / display 'description' missing order=data;
	define retail / display missing  order=data;
	define myCost / display missing  order=data;

	compute _BREAK_;
		if _BREAK_ ne ' ' then do;
			call define(_ROW_,'style','style=[font_weight=bold foreground=Black paddingbottom=10]');
		end;
	endcomp;

	 COMPUTE Before makeNum;                                                               
      LENGTH text $ 50;                                                                
      IF makeNum &amp;gt; 0 THEN DO;                                                                   
		text = cat('Make: ', make); 
         num=50;                                                                       
      END;                                                                             
      ELSE DO;                                                                         
         text = "";                                                                    
         num=0;                                                                        
      END;                                                                             
      LINE text $VARYING. num ; 
   ENDCOMP;                      


run;

quit;

TITLE;
FOOTNOTE;&lt;/STRONG&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/13733i25D30AFB962B6F12/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="2017-04-21_11-04-00.jpg" title="2017-04-21_11-04-00.jpg" /&gt;</description>
      <pubDate>Fri, 21 Apr 2017 16:06:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-Can-I-Put-The-Correct-Value-in-a-Line-Statment-for-a-Compute/m-p/352228#M63990</guid>
      <dc:creator>eg_michael</dc:creator>
      <dc:date>2017-04-21T16:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Put The Correct Value in a Line Statment for a Compute Before</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-Can-I-Put-The-Correct-Value-in-a-Line-Statment-for-a-Compute/m-p/352243#M63991</link>
      <description>&lt;P&gt;Why did you make the data in the data set have the summary values?&amp;nbsp;The breaks in proc report are to help manage summary totals.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just looking at your data I would be more likely to structure the data with Make, Model, Color, retail and cost and let breaks on make and model do the summaries.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 16:57:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-Can-I-Put-The-Correct-Value-in-a-Line-Statment-for-a-Compute/m-p/352243#M63991</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-04-21T16:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Put The Correct Value in a Line Statment for a Compute Before</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-Can-I-Put-The-Correct-Value-in-a-Line-Statment-for-a-Compute/m-p/352285#M63995</link>
      <description>This is a unique situation, I am creating a report from the output of another report.</description>
      <pubDate>Fri, 21 Apr 2017 18:42:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-Can-I-Put-The-Correct-Value-in-a-Line-Statment-for-a-Compute/m-p/352285#M63995</guid>
      <dc:creator>eg_michael</dc:creator>
      <dc:date>2017-04-21T18:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Put The Correct Value in a Line Statment for a Compute Before</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-Can-I-Put-The-Correct-Value-in-a-Line-Statment-for-a-Compute/m-p/352300#M63996</link>
      <description>&lt;P&gt;Unfortunately it is a little difficult to execute with your posted code, given that line structure is important in datalines command. &amp;nbsp;Could you repost with the datalines restructured?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 19:12:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-Can-I-Put-The-Correct-Value-in-a-Line-Statment-for-a-Compute/m-p/352300#M63996</guid>
      <dc:creator>thomp7050</dc:creator>
      <dc:date>2017-04-21T19:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Put The Correct Value in a Line Statment for a Compute Before</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-Can-I-Put-The-Correct-Value-in-a-Line-Statment-for-a-Compute/m-p/352339#M63997</link>
      <description>&lt;P&gt;And my guess is that it's not working because you are trying to use MAKE in the COMPUTE block for MAKENUM. But at the point in time when PROC REPORT is handling MAKENUM, it has not yet put MAKE onto the report row. Remember that PROC REPORT does not have a PDV like the DATA step program.&lt;BR /&gt;&lt;BR /&gt;I am thinking that if you changed &lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;COMPUTE BEFORE MAKENUM;&lt;/FONT&gt;&lt;BR /&gt;to&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;COMPUTE BEFORE MAKE;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;It would probably work. It did for me.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/8484iC55D79C2918828D5/image-size/original?v=1.0&amp;amp;px=-1" alt="drove_my_chevy.png" title="drove_my_chevy.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I have to second what others have said, it seems silly to read the summarized CSV results from a previous PROC REPORT step, when you could easily have had PROC REPORT generate the report for you in the first place. &lt;BR /&gt;&lt;BR /&gt; And you might want to pay attention to the note in the log about the usage of GROUP not being appropriate here anymore because _BREAK_ in this context is a DISPLAY item and so GROUP won't work.&lt;BR /&gt; &lt;BR /&gt;cynthia&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 21:54:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-Can-I-Put-The-Correct-Value-in-a-Line-Statment-for-a-Compute/m-p/352339#M63997</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2017-04-21T21:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Put The Correct Value in a Line Statment for a Compute Before</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-Can-I-Put-The-Correct-Value-in-a-Line-Statment-for-a-Compute/m-p/352385#M64003</link>
      <description>&lt;P&gt;Thank you Cynthia, it worked for me too!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&amp;nbsp;everyone for your critique and advice. I have noted it all.&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;</description>
      <pubDate>Sat, 22 Apr 2017 03:37:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-Can-I-Put-The-Correct-Value-in-a-Line-Statment-for-a-Compute/m-p/352385#M64003</guid>
      <dc:creator>eg_michael</dc:creator>
      <dc:date>2017-04-22T03:37:45Z</dc:date>
    </item>
  </channel>
</rss>

