<?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: How to count characteristics of a variable? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440450#M110025</link>
    <description>I tried something like that:&lt;BR /&gt;proc print&lt;BR /&gt;data= saspms.datensatz_1416_Erstanzeige;&lt;BR /&gt;sum sponsor;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;but it tells me: ERROR: Variable sponsor in list does not match type prescribed for this list.&lt;BR /&gt;</description>
    <pubDate>Tue, 27 Feb 2018 11:03:55 GMT</pubDate>
    <dc:creator>marysmith</dc:creator>
    <dc:date>2018-02-27T11:03:55Z</dc:date>
    <item>
      <title>How to count characteristics of a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440446#M110022</link>
      <description>&lt;P&gt;Dear community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a Character variable "sponsor"s and I need SAS to tell me how many different characters this variable has. How many different sponsors are there?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I do it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2018 10:52:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440446#M110022</guid>
      <dc:creator>marysmith</dc:creator>
      <dc:date>2018-02-27T10:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to count characteristics of a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440448#M110023</link>
      <description>&lt;P&gt;You need to present some test data in the form of a datastep and what you want to see output.&amp;nbsp; There is not enough information to guess here.&amp;nbsp; Maybe a proc freq on that variable?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2018 10:59:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440448#M110023</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-27T10:59:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to count characteristics of a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440450#M110025</link>
      <description>I tried something like that:&lt;BR /&gt;proc print&lt;BR /&gt;data= saspms.datensatz_1416_Erstanzeige;&lt;BR /&gt;sum sponsor;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;but it tells me: ERROR: Variable sponsor in list does not match type prescribed for this list.&lt;BR /&gt;</description>
      <pubDate>Tue, 27 Feb 2018 11:03:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440450#M110025</guid>
      <dc:creator>marysmith</dc:creator>
      <dc:date>2018-02-27T11:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to count characteristics of a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440452#M110027</link>
      <description>&lt;P&gt;I am sure I said "proc freq"?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/procstat/66703/HTML/default/viewer.htm#procstat_freq_syntax.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/procstat/66703/HTML/default/viewer.htm#procstat_freq_syntax.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sum on proc print requires numeric variables, yours is character.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2018 11:05:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440452#M110027</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-27T11:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to count characteristics of a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440456#M110031</link>
      <description>Yes thank you I already did that. But it doesn't show me what I need. I need SAS to count the column sponsors. With proc freq I can only see the frequency of the different sponsors. I want SAS to sum the column sponsors. Do you know what I mean?&lt;BR /&gt;Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 27 Feb 2018 11:10:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440456#M110031</guid>
      <dc:creator>marysmith</dc:creator>
      <dc:date>2018-02-27T11:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to count characteristics of a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440459#M110033</link>
      <description>&lt;P&gt;Well, I can have another guess.&amp;nbsp; Its far simpler if you just provided test data in the form of a datastep, and what you want the output to look like.&amp;nbsp; Maybe:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table want as
  select sponser,
         count(*) as total
  from   have
  group by sponser;
quit;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Feb 2018 11:29:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440459#M110033</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-27T11:29:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to count characteristics of a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440468#M110034</link>
      <description>&lt;P&gt;I think you're getting closer.&amp;nbsp; Here's my interpretation:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;create table want as&lt;/P&gt;
&lt;P&gt;select count(distinct sponsor) as n_sponsors&amp;nbsp;&lt;/P&gt;
&lt;P&gt;from have;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2018 12:03:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440468#M110034</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-02-27T12:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to count characteristics of a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440520#M110046</link>
      <description>&lt;P&gt;Thank you so much! It worked! Yay! Now I want the number of the different sponsors for each year.&lt;/P&gt;&lt;P&gt;Can I do it with the proc sql command? As sponsor is a characteristic variable with different names I have no idea how to do that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created a year variable:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data saspms.datensatz_1416_Erstanzeige;&lt;BR /&gt;set saspms.datensatz_1416_Erstanzeige;&lt;BR /&gt;format n_date ddmmyy10.;&lt;BR /&gt;n_date = input(notificationdate,ddmmyy10.);&lt;BR /&gt;if '01jan2013'd &amp;lt;= n_date &amp;lt;= '31dec2013'd then year=2013;&lt;BR /&gt;if '01jan2014'd &amp;lt;= n_date &amp;lt;= '31dec2014'd then year=2014;&lt;BR /&gt;if '01jan2015'd &amp;lt;= n_date &amp;lt;= '31dec2015'd then year=2015;&lt;BR /&gt;if '01jan2016'd &amp;lt;= n_date &amp;lt;= '31dec2016'd then year=2016;&lt;BR /&gt;if '01jan2017'd &amp;lt;= n_date &amp;lt;= '31dec2017'd then year=2017;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and the sponsor variable:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;data saspms.datensatz_1416_Erstanzeige;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set saspms.datensatz_1416_Erstanzeige;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sponsor = Auftraggeber;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if Auftraggeber = "." then sponsor = Auftraggeber;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else sponsor = Manufacturer; /*Informationen aus Variable Auftraggeber, falls diese nicht vorhanden, Informationen aus Variable Manufacturer/Institution*/&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; label sponsor = "Sponsoren";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cab abybody help please?:)&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2018 14:59:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440520#M110046</guid>
      <dc:creator>marysmith</dc:creator>
      <dc:date>2018-02-27T14:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to count characteristics of a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440523#M110048</link>
      <description>&lt;P&gt;Should really open a new question.&amp;nbsp; Just update the group by to the variables you want to group the data by:&lt;/P&gt;
&lt;PRE&gt;  group by sponser n_date;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Feb 2018 15:07:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440523#M110048</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-27T15:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to count characteristics of a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440534#M110055</link>
      <description>&lt;P&gt;i tried this: but its not working &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;&lt;BR /&gt;create table saspms.sponsoren1 as&lt;BR /&gt;&lt;BR /&gt;select count(distinct sponsor) as n_sponsors&lt;BR /&gt;&lt;BR /&gt;from saspms.datensatz_1416_Erstanzeige;&lt;BR /&gt;group by sponser n_date&lt;BR /&gt;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;SAS tells me:180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2018 15:51:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440534#M110055</guid>
      <dc:creator>marysmith</dc:creator>
      <dc:date>2018-02-27T15:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to count characteristics of a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440540#M110058</link>
      <description>&lt;P&gt;Drop the semicolon after&amp;nbsp;&lt;SPAN&gt;1416_Erstanzeige; &amp;lt;- ther should not be a semicolon until the end of the sql clause (in this case before the quit).&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2018 16:03:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440540#M110058</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-27T16:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to count characteristics of a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440544#M110061</link>
      <description>Thank you! That was it!&lt;BR /&gt;&lt;BR /&gt;The table I get looks like that:&lt;BR /&gt;&lt;BR /&gt;1 61&lt;BR /&gt;&lt;BR /&gt;2 62&lt;BR /&gt;&lt;BR /&gt;3 59&lt;BR /&gt;&lt;BR /&gt;How do I know which number is which year?&lt;BR /&gt;&lt;BR /&gt;Do you have any guess?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 27 Feb 2018 16:08:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440544#M110061</guid>
      <dc:creator>marysmith</dc:creator>
      <dc:date>2018-02-27T16:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to count characteristics of a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440546#M110062</link>
      <description>&lt;PRE&gt;proc sql;
  create table saspms.sponsoren1 as
  select sponsor,
         n_date,
         count(distinct sponsor) as n_sponsors
  from saspms.datensatz_1416_Erstanzeige
  group by sponser,n_date
quit;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Feb 2018 16:11:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440546#M110062</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-27T16:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to count characteristics of a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440549#M110064</link>
      <description>Thank you but that's not quite the result I need.&lt;BR /&gt;&lt;BR /&gt;I need SAS to tell me in year2014 there where n different sponsors, in year 2015 there where n different sponsors and in year 2016 there where n different sponsors.&lt;BR /&gt;Is that even possible? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 27 Feb 2018 16:15:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440549#M110064</guid>
      <dc:creator>marysmith</dc:creator>
      <dc:date>2018-02-27T16:15:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to count characteristics of a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440558#M110067</link>
      <description>&lt;PRE&gt;proc sql;
  create table saspms.sponsoren1 as
  select n_date,       
         count(distinct sponsor) as n_sponsors
  from saspms.datensatz_1416_Erstanzeige
  group by n_date
quit;&lt;/PRE&gt;
&lt;P&gt;This would be far easier if you followed the guidance on posting a new question - provide test data in the form of a datastep, show what the output should look like, etc.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2018 16:30:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-characteristics-of-a-variable/m-p/440558#M110067</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-27T16:30:46Z</dc:date>
    </item>
  </channel>
</rss>

