<?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 CSV with customised sub total labels. in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/CSV-with-customised-sub-total-labels/m-p/5196#M2100</link>
    <description>Thanks for your comments on &lt;BR /&gt;
&lt;A href="http://support.sas.com/forums/message.jspa?messageID=8139#8139" target="_blank"&gt;http://support.sas.com/forums/message.jspa?messageID=8139#8139&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
It worked fine. &lt;BR /&gt;
&lt;BR /&gt;
I am now trying to created a CSV file with the below code. Note there are sub total labels as 'TOTAL' and 'GRAND TOTAL' which creates a problem in the output.&lt;BR /&gt;
&lt;BR /&gt;
I want the output as &lt;BR /&gt;
&lt;BR /&gt;
===============================================&lt;BR /&gt;
&lt;BR /&gt;
"Col1","Col2","Col3","Col4"&lt;BR /&gt;
"Col1","Col2","Col3","Col4"&lt;BR /&gt;
"Col1","Col2","Col3","Col4"&lt;BR /&gt;
TOTAL for Africa   subtotal&lt;BR /&gt;
&lt;BR /&gt;
"Col1","Col2","Col3","Col4"&lt;BR /&gt;
"Col1","Col2","Col3","Col4"&lt;BR /&gt;
"Col1","Col2","Col3","Col4"&lt;BR /&gt;
TOTAL for Canada subtotal&lt;BR /&gt;
&lt;BR /&gt;
GRAND TOTAL     value&lt;BR /&gt;
===============================================&lt;BR /&gt;
&lt;BR /&gt;
Please help. See code below.&lt;BR /&gt;
&lt;BR /&gt;
ods xml file="/apps/sas/ReportsRepository/ExportCSV.csv" type=csvall;&lt;BR /&gt;
proc report data=sashelp.shoes nowd;&lt;BR /&gt;
	COLUMN Region newreg Product newprod Subsidiary Sales;&lt;BR /&gt;
	DEFINE Region / group width=20 noprint;&lt;BR /&gt;
	define newreg /computed 'Region';&lt;BR /&gt;
&lt;BR /&gt;
	DEFINE product / group width=20 noprint;&lt;BR /&gt;
	define newprod /computed 'Product';&lt;BR /&gt;
&lt;BR /&gt;
	DEFINE Sales / ANALYSIS SUM;&lt;BR /&gt;
	*break after Product / summarize;&lt;BR /&gt;
&lt;BR /&gt;
	compute before Region;&lt;BR /&gt;
		** "grab" the region value before it is suppressed;&lt;BR /&gt;
		holdreg = Region;&lt;BR /&gt;
	endcomp;&lt;BR /&gt;
	compute newreg / character length=20;&lt;BR /&gt;
		newreg = holdreg;&lt;BR /&gt;
	endcomp;&lt;BR /&gt;
&lt;BR /&gt;
	compute before Product;&lt;BR /&gt;
		** "grab" the product value before it is suppressed;&lt;BR /&gt;
		holdprod = Product;&lt;BR /&gt;
	endcomp;&lt;BR /&gt;
	compute newprod/ character length=20;&lt;BR /&gt;
		newprod = holdprod;&lt;BR /&gt;
	endcomp;&lt;BR /&gt;
&lt;BR /&gt;
	COMPUTE AFTER Product ;&lt;BR /&gt;
		LINE @59 'TOTAL '&lt;BR /&gt;
		@89 Sales.Sum ;&lt;BR /&gt;
		LINE '';&lt;BR /&gt;
	ENDCOMP;&lt;BR /&gt;
	COMPUTE AFTER ;&lt;BR /&gt;
		LINE @59 'GRAND TOTAL'&lt;BR /&gt;
		@89 Sales.Sum;&lt;BR /&gt;
		LINE '';&lt;BR /&gt;
	ENDCOMP;&lt;BR /&gt;
run;&lt;BR /&gt;
ods _all_ close;</description>
    <pubDate>Thu, 25 Oct 2007 10:32:33 GMT</pubDate>
    <dc:creator>SanjayM</dc:creator>
    <dc:date>2007-10-25T10:32:33Z</dc:date>
    <item>
      <title>CSV with customised sub total labels.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/CSV-with-customised-sub-total-labels/m-p/5196#M2100</link>
      <description>Thanks for your comments on &lt;BR /&gt;
&lt;A href="http://support.sas.com/forums/message.jspa?messageID=8139#8139" target="_blank"&gt;http://support.sas.com/forums/message.jspa?messageID=8139#8139&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
It worked fine. &lt;BR /&gt;
&lt;BR /&gt;
I am now trying to created a CSV file with the below code. Note there are sub total labels as 'TOTAL' and 'GRAND TOTAL' which creates a problem in the output.&lt;BR /&gt;
&lt;BR /&gt;
I want the output as &lt;BR /&gt;
&lt;BR /&gt;
===============================================&lt;BR /&gt;
&lt;BR /&gt;
"Col1","Col2","Col3","Col4"&lt;BR /&gt;
"Col1","Col2","Col3","Col4"&lt;BR /&gt;
"Col1","Col2","Col3","Col4"&lt;BR /&gt;
TOTAL for Africa   subtotal&lt;BR /&gt;
&lt;BR /&gt;
"Col1","Col2","Col3","Col4"&lt;BR /&gt;
"Col1","Col2","Col3","Col4"&lt;BR /&gt;
"Col1","Col2","Col3","Col4"&lt;BR /&gt;
TOTAL for Canada subtotal&lt;BR /&gt;
&lt;BR /&gt;
GRAND TOTAL     value&lt;BR /&gt;
===============================================&lt;BR /&gt;
&lt;BR /&gt;
Please help. See code below.&lt;BR /&gt;
&lt;BR /&gt;
ods xml file="/apps/sas/ReportsRepository/ExportCSV.csv" type=csvall;&lt;BR /&gt;
proc report data=sashelp.shoes nowd;&lt;BR /&gt;
	COLUMN Region newreg Product newprod Subsidiary Sales;&lt;BR /&gt;
	DEFINE Region / group width=20 noprint;&lt;BR /&gt;
	define newreg /computed 'Region';&lt;BR /&gt;
&lt;BR /&gt;
	DEFINE product / group width=20 noprint;&lt;BR /&gt;
	define newprod /computed 'Product';&lt;BR /&gt;
&lt;BR /&gt;
	DEFINE Sales / ANALYSIS SUM;&lt;BR /&gt;
	*break after Product / summarize;&lt;BR /&gt;
&lt;BR /&gt;
	compute before Region;&lt;BR /&gt;
		** "grab" the region value before it is suppressed;&lt;BR /&gt;
		holdreg = Region;&lt;BR /&gt;
	endcomp;&lt;BR /&gt;
	compute newreg / character length=20;&lt;BR /&gt;
		newreg = holdreg;&lt;BR /&gt;
	endcomp;&lt;BR /&gt;
&lt;BR /&gt;
	compute before Product;&lt;BR /&gt;
		** "grab" the product value before it is suppressed;&lt;BR /&gt;
		holdprod = Product;&lt;BR /&gt;
	endcomp;&lt;BR /&gt;
	compute newprod/ character length=20;&lt;BR /&gt;
		newprod = holdprod;&lt;BR /&gt;
	endcomp;&lt;BR /&gt;
&lt;BR /&gt;
	COMPUTE AFTER Product ;&lt;BR /&gt;
		LINE @59 'TOTAL '&lt;BR /&gt;
		@89 Sales.Sum ;&lt;BR /&gt;
		LINE '';&lt;BR /&gt;
	ENDCOMP;&lt;BR /&gt;
	COMPUTE AFTER ;&lt;BR /&gt;
		LINE @59 'GRAND TOTAL'&lt;BR /&gt;
		@89 Sales.Sum;&lt;BR /&gt;
		LINE '';&lt;BR /&gt;
	ENDCOMP;&lt;BR /&gt;
run;&lt;BR /&gt;
ods _all_ close;</description>
      <pubDate>Thu, 25 Oct 2007 10:32:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/CSV-with-customised-sub-total-labels/m-p/5196#M2100</guid>
      <dc:creator>SanjayM</dc:creator>
      <dc:date>2007-10-25T10:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: CSV with customised sub total labels.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/CSV-with-customised-sub-total-labels/m-p/5197#M2101</link>
      <description>I would have tried something that is not really ODS-style, but quite efficient for creating customized flat files like this one...&lt;BR /&gt;
&lt;BR /&gt;
PROC SORT DATA = sashelp.shoes OUT = work.shoes ;&lt;BR /&gt;
BY product ;&lt;BR /&gt;
RUN ;&lt;BR /&gt;
DATA _NULL_ ;&lt;BR /&gt;
SET work.shoes END=theEnd ;&lt;BR /&gt;
BY region ;&lt;BR /&gt;
&lt;BR /&gt;
RETAIN regSales totSales ;&lt;BR /&gt;
&lt;BR /&gt;
FILE "/apps/sas/ReportsRepository/ExportCSV.csv" ;&lt;BR /&gt;
&lt;BR /&gt;
IF _N_=1 THEN totSales = 0 ;&lt;BR /&gt;
IF FIRST.region THEN regSales = 0 ;&lt;BR /&gt;
totSales + sales ;&lt;BR /&gt;
regSales + sales ;&lt;BR /&gt;
&lt;BR /&gt;
PUT col1 "," col2 "," col3 "," col4 ;&lt;BR /&gt;
&lt;BR /&gt;
IF LAST.region THEN DO ;&lt;BR /&gt;
    PUT "TOTAL for " region regSales 12.2 ;&lt;BR /&gt;
    PUT ;&lt;BR /&gt;
END ;&lt;BR /&gt;
&lt;BR /&gt;
IF theEnd THEN PUT "GRAND TOTAL " totSales 15.2 ;&lt;BR /&gt;
RUN ;&lt;BR /&gt;
&lt;BR /&gt;
Is that fine for you ?&lt;BR /&gt;
Olivier</description>
      <pubDate>Thu, 25 Oct 2007 13:14:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/CSV-with-customised-sub-total-labels/m-p/5197#M2101</guid>
      <dc:creator>Olivier</dc:creator>
      <dc:date>2007-10-25T13:14:24Z</dc:date>
    </item>
  </channel>
</rss>

