<?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 assign a proportion to a cluster in multilevel in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-assign-a-proportion-to-a-cluster-in-multilevel/m-p/853617#M337407</link>
    <description>&lt;P&gt;One solution: proc freq for the calculation and and data step merge to add the variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=have noprint;
   by cluster;
   table ab / out=count(where=(Ab ='yes'));
run;

data want;
   merge have count(keep= cluster percent rename=(percent = value));
   by cluster;
   
   if first.cluster then value = value / 100;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 13 Jan 2023 06:43:55 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2023-01-13T06:43:55Z</dc:date>
    <item>
      <title>How to assign a proportion to a cluster in multilevel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-assign-a-proportion-to-a-cluster-in-multilevel/m-p/853606#M337401</link>
      <description>&lt;P&gt;Hello programmers,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll appreciate if anyone can give me an insight. I am trying to assign a value to a cluster of individuals.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each individual have a yes or no response&amp;nbsp; and i want to assign the proportion of yeses to all in the individual in that cluster.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eg. ID is nested in cluster 104; responses are yeses and nos. value is the proportion of "yeses"= 6/20=0.3. My challenge is how to call this value on every ID in the cluster.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;ID	cluster	Ab	value
1	104	yes	0.3
2	104	no	0.3
3	104	no	0.3
4	104	no	0.3
5	104	no	0.3
6	104	no	0.3
7	104	no	0.3
8	104	yes	0.3
9	104	yes	0.3
10	104	yes	0.3
11	104	yes	0.3
12	104	yes	0.3
13	104	no	0.3
14	104	no	0.3
15	104	no	0.3
16	104	no	0.3
17	104	no	0.3
18	104	no	0.3
19	104	no	0.3
20	104	no	0.3&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 02:05:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-assign-a-proportion-to-a-cluster-in-multilevel/m-p/853606#M337401</guid>
      <dc:creator>ChuksManuel</dc:creator>
      <dc:date>2023-01-13T02:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign a proportion to a cluster in multilevel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-assign-a-proportion-to-a-cluster-in-multilevel/m-p/853617#M337407</link>
      <description>&lt;P&gt;One solution: proc freq for the calculation and and data step merge to add the variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=have noprint;
   by cluster;
   table ab / out=count(where=(Ab ='yes'));
run;

data want;
   merge have count(keep= cluster percent rename=(percent = value));
   by cluster;
   
   if first.cluster then value = value / 100;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Jan 2023 06:43:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-assign-a-proportion-to-a-cluster-in-multilevel/m-p/853617#M337407</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2023-01-13T06:43:55Z</dc:date>
    </item>
  </channel>
</rss>

