<?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: Group By in SAS with a Count returns ID locations in table instead of actually IDs in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Group-By-in-SAS-with-a-Count-returns-ID-locations-in-table/m-p/826467#M81964</link>
    <description>&lt;P&gt;There's nothing in your code that will turn the data you show into the output that you show.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Therefore, the problem is that the data in data set MAIN_INFO is not what you say it is; or the output data set TEST_2 is from some other code; or the code is not what you show us.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Please show us the entire LOG for this PROC SQL, copy the log as text and paste it into the window that appears when you click on the &amp;lt;/&amp;gt; icon.&lt;/LI&gt;
&lt;LI&gt;Please show us a screen capture (not typed) of the output data set TEST_2&amp;nbsp;so we can see portions of the data &lt;FONT color="#FF0000"&gt;and the data set name&lt;/FONT&gt;.&lt;/LI&gt;
&lt;LI&gt;Please show us a screen capture of the data set MAIN_INFO so we can see portions of the data &lt;FONT color="#FF0000"&gt;and the data set name&lt;/FONT&gt;.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Example: here is a screen capture, you can see the data set name is SASHELP.CLASS. Use the "Insert Photos" icon to include your screen captures of the output and data; do not attach files.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PaigeMiller_0-1659372927762.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73975iA64BFE9D45AB4EEA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PaigeMiller_0-1659372927762.png" alt="PaigeMiller_0-1659372927762.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 01 Aug 2022 17:01:37 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-08-01T17:01:37Z</dc:date>
    <item>
      <title>Group By in SAS with a Count returns ID locations in table instead of actually IDs</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Group-By-in-SAS-with-a-Count-returns-ID-locations-in-table/m-p/826462#M81961</link>
      <description>&lt;P&gt;When I run a PROC SQL to create a table and in the table I'm retying the user IDs but counting the amount of jobs they have done it returns a C00xx numbers instead of the actual user ID, below is the code I'm using, it's pretty straight forward but it doesn't return the user ID at all with the count. If I remove the count it returns the user ID&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROC SQL ; 
    CREATE TABLE TEST_2 AS 
       SELECT USER_ID , 
       COUNT(JOBS_COMP) AS JOBS_LOW

   FROM MAIN_INFO WHERE JOBS_COMP &amp;lt;= 30 
     GROUP BY USER_ID ;

QUIT;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;MAIN_INFO&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;USER_ID&lt;/TD&gt;&lt;TD&gt;JOB_DATE&lt;/TD&gt;&lt;TD&gt;JOBS_COMP&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;AB123&lt;/TD&gt;&lt;TD&gt;020522&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;BA123&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;040722&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;AB123&lt;/TD&gt;&lt;TD&gt;030922&lt;/TD&gt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t;&lt;TD&gt;AB123&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;BA123&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;AC123&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CA123&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Mon, 01 Aug 2022 16:34:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Group-By-in-SAS-with-a-Count-returns-ID-locations-in-table/m-p/826462#M81961</guid>
      <dc:creator>solelo</dc:creator>
      <dc:date>2022-08-01T16:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: Group By in SAS with a Count returns ID locations in table instead of actually IDs</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Group-By-in-SAS-with-a-Count-returns-ID-locations-in-table/m-p/826463#M81962</link>
      <description>&lt;P&gt;Show us a portion of your data set MAIN_INFO as &lt;FONT color="#FF0000"&gt;working&lt;/FONT&gt; SAS data step code (please test it before posting to make sure the code is working) which you can type in yourself or by following &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;these instructions&lt;/A&gt;&amp;nbsp;(and not in any other format). Show us a portion of the output that is not correct.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2022 16:30:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Group-By-in-SAS-with-a-Count-returns-ID-locations-in-table/m-p/826463#M81962</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-08-01T16:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: Group By in SAS with a Count returns ID locations in table instead of actually IDs</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Group-By-in-SAS-with-a-Count-returns-ID-locations-in-table/m-p/826465#M81963</link>
      <description>&lt;P&gt;From the code shown and the description of " a C00xx numbers instead of the actual user id" it appears that one of these may be happening: The values of the User_id in that set are not as you expect or the variable that has the value you expect is not actually "User_id".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might also show the LOG from running your code. Include the code and any notes. Copy the text from the LOG and paste into a text box opened on the forum with the &amp;lt;/&amp;gt; icon that appears above the message window.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/430711"&gt;@solelo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;When I run a PROC SQL to create a table and in the table I'm retying the user IDs but counting the amount of jobs they have done it returns a C00xx numbers instead of the actual user ID, below is the code I'm using, it's pretty straight forward but it doesn't return the user ID at all with the count. If I remove the count it returns the user ID&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;PROC SQL ; 
    CREATE TABLE TEST_2 AS 
       SELECT USER_ID , 
       COUNT(JOBS_COMP) AS JOBS_LOW

   FROM MAIN_INFO WHERE JOBS_COMP &amp;lt;= 30 
     GROUP BY USER_ID ;

QUIT;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2022 16:27:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Group-By-in-SAS-with-a-Count-returns-ID-locations-in-table/m-p/826465#M81963</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-08-01T16:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: Group By in SAS with a Count returns ID locations in table instead of actually IDs</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Group-By-in-SAS-with-a-Count-returns-ID-locations-in-table/m-p/826467#M81964</link>
      <description>&lt;P&gt;There's nothing in your code that will turn the data you show into the output that you show.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Therefore, the problem is that the data in data set MAIN_INFO is not what you say it is; or the output data set TEST_2 is from some other code; or the code is not what you show us.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Please show us the entire LOG for this PROC SQL, copy the log as text and paste it into the window that appears when you click on the &amp;lt;/&amp;gt; icon.&lt;/LI&gt;
&lt;LI&gt;Please show us a screen capture (not typed) of the output data set TEST_2&amp;nbsp;so we can see portions of the data &lt;FONT color="#FF0000"&gt;and the data set name&lt;/FONT&gt;.&lt;/LI&gt;
&lt;LI&gt;Please show us a screen capture of the data set MAIN_INFO so we can see portions of the data &lt;FONT color="#FF0000"&gt;and the data set name&lt;/FONT&gt;.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Example: here is a screen capture, you can see the data set name is SASHELP.CLASS. Use the "Insert Photos" icon to include your screen captures of the output and data; do not attach files.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PaigeMiller_0-1659372927762.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73975iA64BFE9D45AB4EEA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PaigeMiller_0-1659372927762.png" alt="PaigeMiller_0-1659372927762.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2022 17:01:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Group-By-in-SAS-with-a-Count-returns-ID-locations-in-table/m-p/826467#M81964</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-08-01T17:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: Group By in SAS with a Count returns ID locations in table instead of actually IDs</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Group-By-in-SAS-with-a-Count-returns-ID-locations-in-table/m-p/826478#M81965</link>
      <description>&lt;P&gt;What did you use to produce the first report you showed?&amp;nbsp; Did you run something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select * from main_table;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If so then the USER_ID you see in the column header of the report might be the LABEL attached to the variable and not the NAME of the variable.&amp;nbsp; Check the output of PROC CONTENTS for your MAIN_TABLE.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data=main_table;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Aug 2022 17:39:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Group-By-in-SAS-with-a-Count-returns-ID-locations-in-table/m-p/826478#M81965</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-08-01T17:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: Group By in SAS with a Count returns ID locations in table instead of actually IDs</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Group-By-in-SAS-with-a-Count-returns-ID-locations-in-table/m-p/829556#M81981</link>
      <description>&lt;P&gt;The output is what can be expected from the code and the main info that has been provided in the code.&lt;BR /&gt;The main info does not have C0's. There will be none in the output.&lt;BR /&gt;To get them additional code will be needed to do the transformation. This depend on your business rules.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Aug 2022 13:03:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Group-By-in-SAS-with-a-Count-returns-ID-locations-in-table/m-p/829556#M81981</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2022-08-21T13:03:26Z</dc:date>
    </item>
  </channel>
</rss>

