<?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 Proc Tabulate in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/66446#M18985</link>
    <description>Hello ,&lt;BR /&gt;
&lt;BR /&gt;
Could anyone please help me in the code error, i tried a lot. I used :-&lt;BR /&gt;
&lt;BR /&gt;
PROC Format;&lt;BR /&gt;
	VALUE $SameDayDelivery 1 = 'Yes'&lt;BR /&gt;
						   2 = 'No';&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
/*Proportion of daily transactions that qualify for same day delivery*/&lt;BR /&gt;
proc tabulate data = weekly_sales_revenues f = comma6.;&lt;BR /&gt;
	CLASS LaptopModel ;&lt;BR /&gt;
	VAR   SameDayDelivery ;&lt;BR /&gt;
		LABEL SameDayDelivery='Same Day Delivery';&lt;BR /&gt;
	TABLE DateofSale*SameDayDelivery ALL='Total'*LaptopModel all='Total',UnitsSold&lt;BR /&gt;
	*( MEAN STD MIN MAX sum='Sold'*f=8. pctsum&lt;SAMEDAYDELIVERY all=""&gt;='in %'*f=comma5.1)&lt;BR /&gt;
    /box=[label="Daily Transactions"]&lt;BR /&gt;
;&lt;BR /&gt;
run;  &lt;BR /&gt;
&lt;BR /&gt;
Error -&lt;BR /&gt;
&lt;BR /&gt;
ERROR: Variable SameDayDelivery in list does not match type prescribed for this list.&lt;BR /&gt;
&lt;BR /&gt;
kindly suggest I need to find the proprtion of the Yes and No in SameDayDelivery&lt;BR /&gt;
&lt;BR /&gt;
regards ,&lt;BR /&gt;
mark&lt;/SAMEDAYDELIVERY&gt;</description>
    <pubDate>Wed, 10 Mar 2010 05:26:20 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2010-03-10T05:26:20Z</dc:date>
    <item>
      <title>Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/66446#M18985</link>
      <description>Hello ,&lt;BR /&gt;
&lt;BR /&gt;
Could anyone please help me in the code error, i tried a lot. I used :-&lt;BR /&gt;
&lt;BR /&gt;
PROC Format;&lt;BR /&gt;
	VALUE $SameDayDelivery 1 = 'Yes'&lt;BR /&gt;
						   2 = 'No';&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
/*Proportion of daily transactions that qualify for same day delivery*/&lt;BR /&gt;
proc tabulate data = weekly_sales_revenues f = comma6.;&lt;BR /&gt;
	CLASS LaptopModel ;&lt;BR /&gt;
	VAR   SameDayDelivery ;&lt;BR /&gt;
		LABEL SameDayDelivery='Same Day Delivery';&lt;BR /&gt;
	TABLE DateofSale*SameDayDelivery ALL='Total'*LaptopModel all='Total',UnitsSold&lt;BR /&gt;
	*( MEAN STD MIN MAX sum='Sold'*f=8. pctsum&lt;SAMEDAYDELIVERY all=""&gt;='in %'*f=comma5.1)&lt;BR /&gt;
    /box=[label="Daily Transactions"]&lt;BR /&gt;
;&lt;BR /&gt;
run;  &lt;BR /&gt;
&lt;BR /&gt;
Error -&lt;BR /&gt;
&lt;BR /&gt;
ERROR: Variable SameDayDelivery in list does not match type prescribed for this list.&lt;BR /&gt;
&lt;BR /&gt;
kindly suggest I need to find the proprtion of the Yes and No in SameDayDelivery&lt;BR /&gt;
&lt;BR /&gt;
regards ,&lt;BR /&gt;
mark&lt;/SAMEDAYDELIVERY&gt;</description>
      <pubDate>Wed, 10 Mar 2010 05:26:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/66446#M18985</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-03-10T05:26:20Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/66447#M18986</link>
      <description>Use PROC CONTENTS to analyze the SAS variables in your table -- you are attempting to use a CHARACTER type variable as a VAR statement (analysis) variable.  You must convert the variable from character-type to numeric-type.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 10 Mar 2010 12:08:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/66447#M18986</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-03-10T12:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/66448#M18987</link>
      <description>Hi:&lt;BR /&gt;
  It would be useful to see the WHOLE log, not just a single error message. I see several problems in your code. &lt;BR /&gt;
&lt;BR /&gt;
  It looks like you want to use SameDayDelivery as a CLASS variable (to set categories and see the 'YES' and 'NO' in the row dimension, perhaps?) but then you define the numeric variable in a VAR statement. Numeric variables can be used in a CLASS statement, especially when you want to use a NUMERIC variable to set categories -- this is an acceptable use in PROC TABULATE. For example, with SASHELP.CLASS. In this PROC TABULATE step, I want to use AGE to set groups, so it appears in a CLASS statement:&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc format;&lt;BR /&gt;
  value ag_fmt 11-13 = 'Teens'&lt;BR /&gt;
               14-16 = 'Young Adults';&lt;BR /&gt;
run;&lt;BR /&gt;
         &lt;BR /&gt;
proc tabulate data=sashelp.class;&lt;BR /&gt;
  class sex age;&lt;BR /&gt;
  var height;&lt;BR /&gt;
  table sex*age,&lt;BR /&gt;
        height*mean;&lt;BR /&gt;
  format age ag_fmt.;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
You are also using DateofSale and UnitsSold in a TABLE statement, but do not have either variable listed in either the CLASS or VAR statement. You should be receiving an error message that looks something like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
ERROR: The type of name (DateofSale) is unknown.&lt;BR /&gt;
ERROR: The type of name (UnitsSold) is unknown.&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
The TABULATE documentation is very clear that ALL the variables listed in the TABLE statement must be listed in either a CLASS or a VAR statement. That's because PROC TABULATE needs to know how you intend to use the variable.&lt;BR /&gt;
 &lt;BR /&gt;
You will also have problems with the SameDayDelivery variable. It is in a VAR statement. I assume that it is a NUMERIC variable. It you want to use a format with a NUMERIC variable, then the format must be a NUMERIC format. If you look in the documentation, you will see that there are two types of formats which you can define in a VALUE statement -- character and numeric, as shown below:&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc format;&lt;BR /&gt;
  value ag_fmt 11-13 = 'Teen'&lt;BR /&gt;
               14-16='Young Adult';&lt;BR /&gt;
&lt;BR /&gt;
  value $gend 'F' = 'Female'&lt;BR /&gt;
              'M' = 'Male';&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
             &lt;BR /&gt;
To use these formats, SAS would expect a format statement like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
format age ag_fmt. sex $gend.;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
   &lt;BR /&gt;
As someone has already explained, a format that starts with a '$' is meant to be used with a CHARACTER variable.explained in this posting:&lt;BR /&gt;
&lt;A href="http://support.sas.com/forums/thread.jspa?threadID=8896&amp;amp;tstart=0" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?threadID=8896&amp;amp;tstart=0&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
In that previous posting, you defined 2 NUMERIC formats:&lt;BR /&gt;
[pre]&lt;BR /&gt;
&lt;BR /&gt;
proc format;&lt;BR /&gt;
value prdfmt 1='Period1'&lt;BR /&gt;
             2='Period2';&lt;BR /&gt;
value wkfmt 1='Week1'&lt;BR /&gt;
            2='Week2'&lt;BR /&gt;
            3='Week3'&lt;BR /&gt;
            4='Week4';&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
But then you had a format statement:&lt;BR /&gt;
[pre]FORMAT Period $prdfmt. Week $wkfmt.;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                 &lt;BR /&gt;
Which generated an ERROR message. The ERROR message happened because there was no reason to put a '$' in front of a NUMERIC format name. You didn't define $PRDFMT or $WKFMT, you defined PRDFMT and WKFMT. The '$' means something to PROC FORMAT and to SAS. The correct FORMST statement would have been:&lt;BR /&gt;
[pre]FORMAT Period prdfmt. Week wkfmt.;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
            &lt;BR /&gt;
Again, I suggest you read the documentation for the CLASS, VAR and TABLE statements with PROC TABULATE to see how to use variables for analysis and variables to set categories. Then I suggest you read the documentation on how to define and use formats appropriately.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Wed, 10 Mar 2010 12:27:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/66448#M18987</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-03-10T12:27:28Z</dc:date>
    </item>
  </channel>
</rss>

