<?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: Make a new column with frequency/count in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Make-a-new-column-with-frequency-count/m-p/708994#M26651</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Can you actually type a data set that represents the desired output? I thought you did originally, my code produces that data set, but then you asked more questions and seemed to want something else.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, it's still not clear what result you want, or why you have created the following data set using two SET statements. You have not explained, and I am asking you to please explain, provide details, more than the two words "try this", and SHOW us what you want if it is different than what you asked for in your first message. It's also not clear to me why you have removed the MISSING option from my TABLES statement in PROC FREQ, as I would think you want that based on your original explanation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think your responded to &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/356091"&gt;@anming&lt;/a&gt; thinking that was the OP &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/353472"&gt;@mmea&lt;/a&gt; . I believe anming is proposing an alternate solution?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;My apologies to &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/353472"&gt;@mmea&lt;/a&gt; for the mis-understanding.&lt;/P&gt;</description>
    <pubDate>Fri, 01 Jan 2021 11:46:47 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-01-01T11:46:47Z</dc:date>
    <item>
      <title>Make a new column with frequency/count</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Make-a-new-column-with-frequency-count/m-p/708875#M26626</link>
      <description>&lt;P&gt;Hi. If i have a dataset looking like this&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Event&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01JAN2020&lt;/TD&gt;&lt;TD&gt;event1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01JAN2020&lt;/TD&gt;&lt;TD&gt;event1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01JAN2020&lt;/TD&gt;&lt;TD&gt;event1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;02JAN2020&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;02JAN2020&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Is it possible to make a new dataset that has a column that counts the same combinations? Like this:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;event&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;count&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01JAN2020&lt;/TD&gt;&lt;TD&gt;event1&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;02JAN2020&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Thu, 31 Dec 2020 11:04:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Make-a-new-column-with-frequency-count/m-p/708875#M26626</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2020-12-31T11:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: Make a new column with frequency/count</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Make-a-new-column-with-frequency-count/m-p/708876#M26627</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=have;
    tables date*event/missing noprint out=_counts_;
run;
data want;
    merge have _counts_;
    by date event;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This assumes the data set is sorted by DATE and EVENT.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Dec 2020 12:18:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Make-a-new-column-with-frequency-count/m-p/708876#M26627</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-12-31T12:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: Make a new column with frequency/count</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Make-a-new-column-with-frequency-count/m-p/708881#M26629</link>
      <description>&lt;P&gt;Thanks. i works.&lt;/P&gt;&lt;P&gt;Can i then put it in a proc sql an only get the distinct values.&lt;/P&gt;&lt;P&gt;Because now in my data the same combinations can appear multiple times&lt;/P&gt;</description>
      <pubDate>Thu, 31 Dec 2020 12:42:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Make-a-new-column-with-frequency-count/m-p/708881#M26629</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2020-12-31T12:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: Make a new column with frequency/count</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Make-a-new-column-with-frequency-count/m-p/708891#M26633</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/353472"&gt;@mmea&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can i then put it in a proc sql an only get the distinct values.&lt;/P&gt;
&lt;P&gt;Because now in my data the same combinations can appear multiple times&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Doesn't PROC FREQ give you the distinct combinations of date and event? What do you mean by the above? Show us what you mean.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Dec 2020 14:14:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Make-a-new-column-with-frequency-count/m-p/708891#M26633</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-12-31T14:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: Make a new column with frequency/count</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Make-a-new-column-with-frequency-count/m-p/708898#M26636</link>
      <description>&lt;P&gt;Somebody who wants SQL solutions is likely my colleague either in RI, MA, CT or PA&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

data have;
input Date :date9.	Event $;
format date date9.;
cards;
01JAN2020	event1
01JAN2020	event1
01JAN2020	event1
02JAN2020	.
02JAN2020	.
;
proc sql;
 create table want as
 select date, event, count(*) as count
 from have
 group by date, event;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Dec 2020 15:14:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Make-a-new-column-with-frequency-count/m-p/708898#M26636</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-12-31T15:14:06Z</dc:date>
    </item>
    <item>
      <title>Re: Make a new column with frequency/count</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Make-a-new-column-with-frequency-count/m-p/708959#M26641</link>
      <description>&lt;P&gt;data have;&lt;BR /&gt;input Date date9. Event $;&lt;BR /&gt;format date date9.;&lt;BR /&gt;cards;&lt;BR /&gt;01JAN2020 event1&lt;BR /&gt;01JAN2020 event1&lt;BR /&gt;01JAN2020 event1&lt;BR /&gt;01JAN2020 event1&lt;BR /&gt;02JAN2020 .&lt;BR /&gt;02JAN2020 .&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;proc freq data=have ;&lt;BR /&gt;tables date/out=test1;&lt;BR /&gt;/* output _counts_; */&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data want1;&lt;BR /&gt;set test1 (drop=percent);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data want2;&lt;BR /&gt;set have; &lt;BR /&gt;set want1;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try this.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Dec 2020 22:19:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Make-a-new-column-with-frequency-count/m-p/708959#M26641</guid>
      <dc:creator>anming</dc:creator>
      <dc:date>2020-12-31T22:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Make a new column with frequency/count</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Make-a-new-column-with-frequency-count/m-p/708961#M26642</link>
      <description>&lt;P&gt;Can you actually type a data set that represents the desired output? I thought you did originally, my code produces that data set, but then you asked more questions and seemed to want something else.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, it's still not clear what result you want, or why you have created the following data set using two SET statements. You have not explained, and I am asking you to please explain, provide details, more than the two words "try this", and SHOW us what you want if it is different than what you asked for in your first message. It's also not clear to me why you have removed the MISSING option from my TABLES statement in PROC FREQ, as I would think you want that based on your original explanation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Dec 2020 22:32:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Make-a-new-column-with-frequency-count/m-p/708961#M26642</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-12-31T22:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: Make a new column with frequency/count</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Make-a-new-column-with-frequency-count/m-p/708964#M26645</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Can you actually type a data set that represents the desired output? I thought you did originally, my code produces that data set, but then you asked more questions and seemed to want something else.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, it's still not clear what result you want, or why you have created the following data set using two SET statements. You have not explained, and I am asking you to please explain, provide details, more than the two words "try this", and SHOW us what you want if it is different than what you asked for in your first message. It's also not clear to me why you have removed the MISSING option from my TABLES statement in PROC FREQ, as I would think you want that based on your original explanation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you responded to &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/356091"&gt;@anming&lt;/a&gt; thinking that was the OP &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/353472"&gt;@mmea&lt;/a&gt; . I believe anming is proposing an alternate solution?&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jan 2021 16:45:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Make-a-new-column-with-frequency-count/m-p/708964#M26645</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-01-01T16:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: Make a new column with frequency/count</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Make-a-new-column-with-frequency-count/m-p/708965#M26646</link>
      <description>&lt;P&gt;yes. I am trying to provide an alternative solution.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Dec 2020 22:51:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Make-a-new-column-with-frequency-count/m-p/708965#M26646</guid>
      <dc:creator>anming</dc:creator>
      <dc:date>2020-12-31T22:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: Make a new column with frequency/count</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Make-a-new-column-with-frequency-count/m-p/708992#M26650</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/356091"&gt;@anming&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;yes. I am trying to provide an alternative solution.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Alternative in what way? It doesn't appear to give the same answer as was requested in the original message.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jan 2021 11:46:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Make-a-new-column-with-frequency-count/m-p/708992#M26650</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-01-01T11:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: Make a new column with frequency/count</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Make-a-new-column-with-frequency-count/m-p/708994#M26651</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Can you actually type a data set that represents the desired output? I thought you did originally, my code produces that data set, but then you asked more questions and seemed to want something else.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, it's still not clear what result you want, or why you have created the following data set using two SET statements. You have not explained, and I am asking you to please explain, provide details, more than the two words "try this", and SHOW us what you want if it is different than what you asked for in your first message. It's also not clear to me why you have removed the MISSING option from my TABLES statement in PROC FREQ, as I would think you want that based on your original explanation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think your responded to &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/356091"&gt;@anming&lt;/a&gt; thinking that was the OP &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/353472"&gt;@mmea&lt;/a&gt; . I believe anming is proposing an alternate solution?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;My apologies to &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/353472"&gt;@mmea&lt;/a&gt; for the mis-understanding.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jan 2021 11:46:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Make-a-new-column-with-frequency-count/m-p/708994#M26651</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-01-01T11:46:47Z</dc:date>
    </item>
  </channel>
</rss>

