<?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: Referencing other variables in same array in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Referencing-other-variables-in-same-array/m-p/592407#M18118</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if x{1}=1 and sum(of x{*})=1 then cough_only=1;
if x{2}=1 and sum(of x{*})=1 then malnutrition_only=1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or you could do this in a loop where instead of cough_only=1 you have y{1}=1 &lt;/P&gt;</description>
    <pubDate>Sat, 28 Sep 2019 16:02:13 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2019-09-28T16:02:13Z</dc:date>
    <item>
      <title>Referencing other variables in same array</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Referencing-other-variables-in-same-array/m-p/592405#M18117</link>
      <description>&lt;P&gt;Hello expert SAS data management coders,&lt;/P&gt;&lt;P&gt;I have several dichotomous variables indicating the presence of clinical symptoms (i.e. cough, fever, etc) in an array. I would like to know if patients had "only cough," "only fever," etc. I have put some simplified, example code below with what I would like to happen in [brackets].&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully this is a simple question, but if it is complicated, I can look at other routes. But I have had this question in general for a while now and so figured I would go ahead and ask. None of the references I can find on arrays seem to address this specific question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for your assistance.&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array x {*} cough malnutrition fever lethargy;
array y {*} cough_only malnutrition_only fever_only lethargy_only 
		do i=1 to dim(x);
			if x{i}=1 and [all other variables in the array equal 0] then y{i}=1; &lt;BR /&gt;                        else y{I}=0;
		end; drop i;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 28 Sep 2019 15:56:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Referencing-other-variables-in-same-array/m-p/592405#M18117</guid>
      <dc:creator>jpsmith</dc:creator>
      <dc:date>2019-09-28T15:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: Referencing other variables in same array</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Referencing-other-variables-in-same-array/m-p/592407#M18118</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if x{1}=1 and sum(of x{*})=1 then cough_only=1;
if x{2}=1 and sum(of x{*})=1 then malnutrition_only=1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or you could do this in a loop where instead of cough_only=1 you have y{1}=1 &lt;/P&gt;</description>
      <pubDate>Sat, 28 Sep 2019 16:02:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Referencing-other-variables-in-same-array/m-p/592407#M18118</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-09-28T16:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: Referencing other variables in same array</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Referencing-other-variables-in-same-array/m-p/592408#M18119</link>
      <description>&lt;P&gt;Perfect - thanks so much! Didn't know about the {*}.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Sep 2019 16:02:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Referencing-other-variables-in-same-array/m-p/592408#M18119</guid>
      <dc:creator>jpsmith</dc:creator>
      <dc:date>2019-09-28T16:02:49Z</dc:date>
    </item>
  </channel>
</rss>

