<?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 Freq is duplicating  responses in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Proc-Freq-is-duplicating-responses/m-p/796175#M32962</link>
    <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;I had an issue with SAS converting my numeric variables to character variables when imported from excel. To go around that, I saved it as a CSV then imported it. Now, I am doing a proc frequency on a character variable, and SAS is duplicating those variables. See pic below! On my spread sheet, I only have Female, Male, and Unknown, however, why are they being duplicated?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CatPaws_0-1644882855929.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/68465i25AF5591618E6FA9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CatPaws_0-1644882855929.png" alt="CatPaws_0-1644882855929.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;P.S How can I get UNKNOW to display the full name (UNKNOWN)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Feb 2022 23:58:21 GMT</pubDate>
    <dc:creator>CatPaws</dc:creator>
    <dc:date>2022-02-14T23:58:21Z</dc:date>
    <item>
      <title>Proc Freq is duplicating  responses</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-Freq-is-duplicating-responses/m-p/796175#M32962</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;I had an issue with SAS converting my numeric variables to character variables when imported from excel. To go around that, I saved it as a CSV then imported it. Now, I am doing a proc frequency on a character variable, and SAS is duplicating those variables. See pic below! On my spread sheet, I only have Female, Male, and Unknown, however, why are they being duplicated?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CatPaws_0-1644882855929.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/68465i25AF5591618E6FA9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CatPaws_0-1644882855929.png" alt="CatPaws_0-1644882855929.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;P.S How can I get UNKNOW to display the full name (UNKNOWN)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 23:58:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-Freq-is-duplicating-responses/m-p/796175#M32962</guid>
      <dc:creator>CatPaws</dc:creator>
      <dc:date>2022-02-14T23:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq is duplicating  responses</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-Freq-is-duplicating-responses/m-p/796182#M32963</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Quick solution:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FEMALE is not the same as female. The case difference does matter to SAS, though you can make it not matter by applying a format to make it consistent. Case doesn't matter to &lt;U&gt;code&lt;/U&gt;, but it does matter to &lt;U&gt;data&lt;/U&gt;. So proc freq is the same as PROC FREQ. In comparison, Python and R are both case sensitive in language AND data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=have;
table sex / missing;
format sex $upcase18.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However, to fix the unknown you will need to actually fix your data that you imported. I'm guessing you used PROC IMPORT and didn't write a data step? In that case, I would recommend adding the following statement to the PROC IMPORT code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;guessingrows=max;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This forces SAS to scan the full row before it imports the data, so it will really slow down your import process but you'll get cleaner data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Optimal solution:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Write an import step that will correctly read the file. You can use the code from the log as a starter version.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And then to correct the case, use a data step and clean up the data, likely using &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/n169kj2of5nur0n1bl1hubv55q63.htm" target="_self"&gt;PROPCASE&lt;/A&gt;, which will convert everything to lowercase and upper case the first character. Then run your proc freq.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data clean;
set raw_data_from_import;

sex = propcase(sex);

run;

proc freq data=clean;
table sex;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/416743"&gt;@CatPaws&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi!&lt;/P&gt;
&lt;P&gt;I had an issue with SAS converting my numeric variables to character variables when imported from excel. To go around that, I saved it as a CSV then imported it. Now, I am doing a proc frequency on a character variable, and SAS is duplicating those variables. See pic below! On my spread sheet, I only have Female, Male, and Unknown, however, why are they being duplicated?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CatPaws_0-1644882855929.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/68465i25AF5591618E6FA9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CatPaws_0-1644882855929.png" alt="CatPaws_0-1644882855929.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;P.S How can I get UNKNOW to display the full name (UNKNOWN)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 00:14:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-Freq-is-duplicating-responses/m-p/796182#M32963</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-02-15T00:14:52Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq is duplicating  responses</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-Freq-is-duplicating-responses/m-p/796199#M32964</link>
      <description>&lt;P&gt;Case is not the only thing can create the appearance of "duplicate" values in Proc Freq (and many other output tables).&lt;/P&gt;
&lt;P&gt;Please copy and run this code locally:&lt;/P&gt;
&lt;PRE&gt;data example;
  length text $ 10;
  text= 'abc';output;
  text= ' abc';output;
run;

proc freq data=example;
run;&lt;/PRE&gt;
&lt;P&gt;The output from proc freq looks like you have "duplicate" values for text. In reality the second value has a leading space but Proc Freq just does not show it as the table output rules left justifies the text. For added fun add more spaces in front of some more values and you can have, apparently, 4, 5 or 6 "duplicates".&lt;/P&gt;
&lt;P&gt;This is actually a tad harder to diagnose, at least the first time you see it, then different actual displayed values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 04:38:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-Freq-is-duplicating-responses/m-p/796199#M32964</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-02-15T04:38:50Z</dc:date>
    </item>
  </channel>
</rss>

