<?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: Proc Tabulate in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/64778#M18422</link>
    <description>Mark;&lt;BR /&gt;
&lt;BR /&gt;
Come on.  You have not applied any of the things we have given you.  You still are not converting your dates to SAS dates.&lt;BR /&gt;
&lt;BR /&gt;
Frankly, if this is for a class, you need to do your own homework.  If this is for work, you are not qualified.</description>
    <pubDate>Thu, 04 Mar 2010 16:25:06 GMT</pubDate>
    <dc:creator>Flip</dc:creator>
    <dc:date>2010-03-04T16:25:06Z</dc:date>
    <item>
      <title>Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/64775#M18419</link>
      <description>Hello All ,&lt;BR /&gt;
&lt;BR /&gt;
I'm using PROC TABULATE. I have pasted some sample  data below as I have nearly 400+ observations. &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
              Transaction                        Timeof       Laptop      Units&lt;BR /&gt;
                 ID             DateofSale       Sale         Model      Sold    Warranty    Week&lt;BR /&gt;
 &lt;BR /&gt;
             RX000476      23/11/2009    09:40:09    AP3965       1          0            Week4&lt;BR /&gt;
              RX000475      23/11/2009    23:28:37    AP3965      1          0            Week4&lt;BR /&gt;
              RX000474      23/11/2009    06:50:40    AP3965      1          0            Week4&lt;BR /&gt;
              RX000473      23/11/2009    09:47:16    AP3965      1          0            Week4&lt;BR /&gt;
              RX000472      23/11/2009    05:35:33    AP3965      1          0            Week4&lt;BR /&gt;
              RX000471      23/11/2009    14:26:35    AT3600       1          0            Week4&lt;BR /&gt;
              RX000470      23/11/2009    07:33:28    AT3600       1          0            Week4&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Objective is - To find the # UnitsSold of each kind of LaptopModel - AP3965 &amp;amp; AT3600 for each of the four weeks spread over one month.&lt;BR /&gt;
&lt;BR /&gt;
The code I used :-&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data week;&lt;BR /&gt;
set sales;&lt;BR /&gt;
	IF DateofSale &amp;gt;= "01/11/2009" and DateofSale &amp;lt; "08/11/2009" THEN &lt;BR /&gt;
		Week = "Week1";&lt;BR /&gt;
	Else IF DateofSale &amp;gt;= "08/11/2009" and DateofSale &amp;lt; "15/11/2009" THEN&lt;BR /&gt;
		Week = "Week2";&lt;BR /&gt;
	Else IF DateofSale &amp;gt;= "15/11/2009" and DateofSale &amp;lt; "22/11/2009" THEN &lt;BR /&gt;
		Week = "Week3";&lt;BR /&gt;
	ELSE IF DateofSale &amp;gt;= "22/11/2009" and DateofSale &amp;lt; "29/11/2009" THEN &lt;BR /&gt;
		Week = "Week4";&lt;BR /&gt;
Proc Print data = week;&lt;BR /&gt;
Run;	&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Data Tabulate;&lt;BR /&gt;
set sales;&lt;BR /&gt;
proc tabulate data=tables f=dollar8.;&lt;BR /&gt;
   class week Laptopmodel;&lt;BR /&gt;
   var  UnitsSold;&lt;BR /&gt;
   table week*Laptopmodel,&lt;BR /&gt;
         Unitssold*Mean=" ";&lt;BR /&gt;
run;&lt;BR /&gt;
proc print data = Tabulate;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
The log -&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
522  proc tabulate data=tables f=dollar8.;&lt;BR /&gt;
ERROR: File WORK.TABLES.DATA does not exist.&lt;BR /&gt;
523     class week Laptopmodel;&lt;BR /&gt;
ERROR: No data set open to look up variables.&lt;BR /&gt;
ERROR: No data set open to look up variables.&lt;BR /&gt;
524     var  UnitsSold;&lt;BR /&gt;
ERROR: No data set open to look up variables.&lt;BR /&gt;
525     table week*Laptopmodel,&lt;BR /&gt;
526           Unitssold*Mean=" ";&lt;BR /&gt;
527  run;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;
&lt;BR /&gt;
Kindly  suggest what chnage do I need in the  2nd code.&lt;BR /&gt;
&lt;BR /&gt;
Kind  Regards ,&lt;BR /&gt;
Mark</description>
      <pubDate>Thu, 04 Mar 2010 15:23:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/64775#M18419</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-03-04T15:23:05Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/64776#M18420</link>
      <description>You really need to work out your logic in that data step.&lt;BR /&gt;
&lt;BR /&gt;
Have you even writen anything for proc tabulate?</description>
      <pubDate>Thu, 04 Mar 2010 15:59:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/64776#M18420</guid>
      <dc:creator>RickM</dc:creator>
      <dc:date>2010-03-04T15:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/64777#M18421</link>
      <description>Hi:&lt;BR /&gt;
  The &amp;amp;GT; in your code is causing your code not to post correctly. As previously recommended, this posting explains how to use &amp;amp;ampGT; as the way to show &amp;gt;, and [pre] and [/pre] to surround your code.&lt;BR /&gt;
&lt;A href="http://support.sas.com/forums/thread.jspa?messageID=27609毙" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?messageID=27609毙&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
  But, if you are willing to read some user group papers on PROC TABULATE, the TABLE statement needed to achieve your report is fairly straightforward.&lt;BR /&gt;
 &lt;A href="http://www2.sas.com/proceedings/sugi30/243-30.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi30/243-30.pdf&lt;/A&gt;&lt;BR /&gt;
 &lt;A href="http://www.ats.ucla.edu/stat/SAS/faq/tabulate.htm" target="_blank"&gt;http://www.ats.ucla.edu/stat/SAS/faq/tabulate.htm&lt;/A&gt;&lt;BR /&gt;
 &lt;A href="http://www2.sas.com/proceedings/sugi30/258-30.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi30/258-30.pdf&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
  I generally recommend that you draw a little picture of what you want your output table to look like, because, when you're starting out, that helps you decide which variables go in ROW versus COL dimensions in the TABLE statement. The model syntax for PROC TABULATE is shown below using SASHELP.SHOES:&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc tabulate data=sashelp.shoes;&lt;BR /&gt;
class region product;&lt;BR /&gt;
var sales;&lt;BR /&gt;
table region all,&lt;BR /&gt;
      product*sales*mean;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
which "translates" to:&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc tabulate data=&lt;I&gt;dataset&lt;/I&gt;;&lt;BR /&gt;
class &lt;I&gt; classvar (or list multiple)&lt;/I&gt;;&lt;BR /&gt;
var &lt;I&gt;analysis_var (or list multiple)&lt;/I&gt;;&lt;BR /&gt;
table &lt;I&gt;row_dimension&lt;/I&gt;,&lt;BR /&gt;
      &lt;I&gt;column_dimension&lt;/I&gt;;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
For this PROC TABULATE, REGION and PRODUCT are going to set the groups and SALES will be used for analysis. REGION will be in the ROW dimension and PRODUCT will be in the COL dimension. The statistic that I will get for PRODUCT is the average sales for each product. If, on the other hand, I wanted a simple count of sales, then either of these programs would produce that number, depending on whether I wanted to actually count the number of SALES (the first example) or the number of observations for each product (the second examle). In some instances, the two tabulates could give the same results, in other instances, they might give different results (depending on your data):&lt;BR /&gt;
[pre]&lt;BR /&gt;
&lt;BR /&gt;
proc tabulate data=sashelp.shoes f=comma6.;&lt;BR /&gt;
class region product;&lt;BR /&gt;
var sales;&lt;BR /&gt;
table region all,&lt;BR /&gt;
      product*sales*n;&lt;BR /&gt;
run;&lt;BR /&gt;
                       &lt;BR /&gt;
&lt;BR /&gt;
proc tabulate data=sashelp.shoes f=comma6.;&lt;BR /&gt;
class region product;&lt;BR /&gt;
table region all,&lt;BR /&gt;
      product*n;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
It is going to be impossible for you to learn how to use PROC TABULATE effectively without reading about how the CLASS, VAR and TABLE statements need to work together.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Thu, 04 Mar 2010 16:21:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/64777#M18421</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-03-04T16:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/64778#M18422</link>
      <description>Mark;&lt;BR /&gt;
&lt;BR /&gt;
Come on.  You have not applied any of the things we have given you.  You still are not converting your dates to SAS dates.&lt;BR /&gt;
&lt;BR /&gt;
Frankly, if this is for a class, you need to do your own homework.  If this is for work, you are not qualified.</description>
      <pubDate>Thu, 04 Mar 2010 16:25:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/64778#M18422</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2010-03-04T16:25:06Z</dc:date>
    </item>
  </channel>
</rss>

