<?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: crosstabs using format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/crosstabs-using-format/m-p/443492#M282859</link>
    <description>&lt;P&gt;As &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/181543"&gt;@svh&lt;/a&gt;&amp;nbsp;indicates, you have to tell SAS which variable will use which format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;format &lt;FONT color="#008080" face="Courier New" size="2"&gt;Used_a_recommendation&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;FONT color="#008080" face="Courier New" size="2"&gt;$Used_a_recommendation.&lt;/FONT&gt; &lt;FONT color="#008080" face="Courier New" size="2"&gt;Race&lt;/FONT&gt; &lt;FONT color="#008080" face="Courier New" size="2"&gt;$Race.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;This makes sense when you realize SAS supplies a large number of formats and multiple variables can use the same format. You decide which otherwise you get a generic best. format for numeric and $ for character variables.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Your log would show an error similar to this:&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT face="Courier New" size="2"&gt;743   format $Used_a_recommendation. $Race.;
             -----------------------
             22
             76
ERROR 22-322: Syntax error, expecting one of the following: a name, _ALL_, _CHARACTER_, _CHAR_,
              _NUMERIC_.
ERROR 76-322: Syntax error, statement will be ignored.

&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;The underscores are indicating that BEFORE the format name SAS expects something to indicate which variable(s) to apply the format to. "a name" means the name of one or more variables, the other items are lists that indicate all variables, all character variables or all numeric variables. The error is generic and doesn't care that the format indicated is supposedly a character format.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Mar 2018 20:23:52 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-03-07T20:23:52Z</dc:date>
    <item>
      <title>crosstabs using format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/crosstabs-using-format/m-p/443486#M282856</link>
      <description>&lt;P&gt;I am trying to run a crosstabs against the table I imported after changing my format. I have the import and format correct, why can I not run a crosstabs? Below is my program ( I removed the datafile name)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;import&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;OUT&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=mylib.a&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;DATAFILE&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;DBMS&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=xlsx REPLACE;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;SHEET&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Sheet1'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;GETNAMES&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=YES;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;format&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;value&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; $Race &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'C'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Caucasian'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'AA'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'African American'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'A'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Asian'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'O'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;, &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'U'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Other/Unknown'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;value&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; $Used_a_recommendation &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Yes'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Yes'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'No'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'No'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'N/A'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'N/A'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;freq&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = mylib.a;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;tables&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Used_a_recommendation*Race /&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;list&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;missing&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;format&lt;/FONT&gt; &lt;FONT color="#008080" face="Courier New" size="2"&gt;$Used_a_recommendation.&lt;/FONT&gt; &lt;FONT color="#008080" face="Courier New" size="2"&gt;$Race.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 20:11:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/crosstabs-using-format/m-p/443486#M282856</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2018-03-07T20:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: crosstabs using format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/crosstabs-using-format/m-p/443488#M282857</link>
      <description>&lt;P&gt;For the format statement try this pattern (you have to specify the variable if the format is not applied in another way):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;format Used_a_recommendation $&lt;SPAN&gt;Used_a_recommendation.&lt;/SPAN&gt;&amp;nbsp;;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 20:15:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/crosstabs-using-format/m-p/443488#M282857</guid>
      <dc:creator>svh</dc:creator>
      <dc:date>2018-03-07T20:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: crosstabs using format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/crosstabs-using-format/m-p/443490#M282858</link>
      <description>&lt;P&gt;Perfect! That worked. Thank you so much!&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 20:18:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/crosstabs-using-format/m-p/443490#M282858</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2018-03-07T20:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: crosstabs using format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/crosstabs-using-format/m-p/443492#M282859</link>
      <description>&lt;P&gt;As &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/181543"&gt;@svh&lt;/a&gt;&amp;nbsp;indicates, you have to tell SAS which variable will use which format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;format &lt;FONT color="#008080" face="Courier New" size="2"&gt;Used_a_recommendation&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;FONT color="#008080" face="Courier New" size="2"&gt;$Used_a_recommendation.&lt;/FONT&gt; &lt;FONT color="#008080" face="Courier New" size="2"&gt;Race&lt;/FONT&gt; &lt;FONT color="#008080" face="Courier New" size="2"&gt;$Race.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;This makes sense when you realize SAS supplies a large number of formats and multiple variables can use the same format. You decide which otherwise you get a generic best. format for numeric and $ for character variables.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Your log would show an error similar to this:&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT face="Courier New" size="2"&gt;743   format $Used_a_recommendation. $Race.;
             -----------------------
             22
             76
ERROR 22-322: Syntax error, expecting one of the following: a name, _ALL_, _CHARACTER_, _CHAR_,
              _NUMERIC_.
ERROR 76-322: Syntax error, statement will be ignored.

&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;The underscores are indicating that BEFORE the format name SAS expects something to indicate which variable(s) to apply the format to. "a name" means the name of one or more variables, the other items are lists that indicate all variables, all character variables or all numeric variables. The error is generic and doesn't care that the format indicated is supposedly a character format.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 20:23:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/crosstabs-using-format/m-p/443492#M282859</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-07T20:23:52Z</dc:date>
    </item>
  </channel>
</rss>

