<?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: Crosstables with arrays / several conditions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Crosstables-with-arrays-several-conditions/m-p/94281#M19851</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Input:&lt;/P&gt;&lt;P&gt;Dummy variable gdrg&lt;/P&gt;&lt;P&gt;set of alphanumeric variables icd_n* where star is a number from 1 to 100. Variables have values "test","test1",test2",...., "test100"&lt;/P&gt;&lt;P&gt;character variable fab with values "fab1", "fab2",...."fab100"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;A table counting all observations, excluding gdrg =0;&lt;/P&gt;&lt;P&gt;Columns: fab1 to fab100&lt;/P&gt;&lt;P&gt;Rows: test1, test10, test50, test70&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The thing is, test1,10,... can occur in all icd_n* variables. If the icd_n* value, which is selected for the rows, occurs together with another one of the selected row values within one observation but in different icd_n* variables, they should be accounted for separately. Hope that this explanation is more clear.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 01 Apr 2013 20:21:52 GMT</pubDate>
    <dc:creator>dennisl</dc:creator>
    <dc:date>2013-04-01T20:21:52Z</dc:date>
    <item>
      <title>Crosstables with arrays / several conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Crosstables-with-arrays-several-conditions/m-p/94279#M19849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear SAS users,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to make a Crosstable with a character variable called fab and a set of variables, for which I made an array. The variables in the array all contain names with the chain icd_nd* where star is a number from 1 to 89.&lt;/P&gt;&lt;P&gt;The crosstable should contain only observations where the condition of another variable, which is a dummy, having the value 1 is fulfilled (gdrg = 1). Another condition should be that that only a set of approximately 30 values, which appear in icd_nd* should be accounted for in the crosstab. For example, I want to look whether the value "test" is in all icd_nd* and crosstab it with fab. Then I want to look if "test1" is in icd_nd* and crosstab it, independent whether "test" is in icd_nd*.&lt;/P&gt;&lt;P&gt;So I have two conditions, gdrg=1 and whether a set of values is in icd_nd*. I could use "where (gdrg =1);" for the first condition, but I dont know if the solution for the latter problem would have an impact on this syntax. Can you help me with the solution for my latter problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Dennis&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Apr 2013 18:34:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Crosstables-with-arrays-several-conditions/m-p/94279#M19849</guid>
      <dc:creator>dennisl</dc:creator>
      <dc:date>2013-04-01T18:34:38Z</dc:date>
    </item>
    <item>
      <title>Re: Crosstables with arrays / several conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Crosstables-with-arrays-several-conditions/m-p/94280#M19850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please give us a small example of input and expected output data. - PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Apr 2013 18:57:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Crosstables-with-arrays-several-conditions/m-p/94280#M19850</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-04-01T18:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: Crosstables with arrays / several conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Crosstables-with-arrays-several-conditions/m-p/94281#M19851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Input:&lt;/P&gt;&lt;P&gt;Dummy variable gdrg&lt;/P&gt;&lt;P&gt;set of alphanumeric variables icd_n* where star is a number from 1 to 100. Variables have values "test","test1",test2",...., "test100"&lt;/P&gt;&lt;P&gt;character variable fab with values "fab1", "fab2",...."fab100"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;A table counting all observations, excluding gdrg =0;&lt;/P&gt;&lt;P&gt;Columns: fab1 to fab100&lt;/P&gt;&lt;P&gt;Rows: test1, test10, test50, test70&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The thing is, test1,10,... can occur in all icd_n* variables. If the icd_n* value, which is selected for the rows, occurs together with another one of the selected row values within one observation but in different icd_n* variables, they should be accounted for separately. Hope that this explanation is more clear.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Apr 2013 20:21:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Crosstables-with-arrays-several-conditions/m-p/94281#M19851</guid>
      <dc:creator>dennisl</dc:creator>
      <dc:date>2013-04-01T20:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: Crosstables with arrays / several conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Crosstables-with-arrays-several-conditions/m-p/94282#M19852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Something like this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt;"&gt;data have;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;input gdrg (icd_n1-icd_n5) ($) fab $;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;datalines;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;1 test1 test10 test test70 test50 fab51 &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;1 test15 test10 test test70 test50 fab4&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;0 test10 test10 test test50 test15 fab32&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;1 test1 test10 test15 test70 test50 fab4&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;1 test1 test15 test test70 test50 fab10&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt;"&gt;data haveList(keep=t fab);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;set have;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;array icd_n{100};&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;if gdrg;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;do i = 1 to dim(icd_n);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t = icd_n{i};&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not missing(t) then output;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt;"&gt;proc sql;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;create table wantList as&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;select t, fab, count(*) as n&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;from haveList&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;group by t, fab&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;order by t;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt;"&gt;proc transpose data=wantList out=want(drop=_name_);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;by t;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;var n;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;id fab;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Apr 2013 02:26:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Crosstables-with-arrays-several-conditions/m-p/94282#M19852</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-04-02T02:26:48Z</dc:date>
    </item>
  </channel>
</rss>

