<?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: Update a variable’s value based on the value of another variable in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Update-a-variable-s-value-based-on-the-value-of-another-variable/m-p/990358#M43984</link>
    <description>&lt;P&gt;No.&amp;nbsp; There is no magic formula to break summarized data into sub categories.&lt;/P&gt;
&lt;P&gt;You will need to go back to the original data and perform the actual counting that you want.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Jul 2026 14:38:22 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2026-07-01T14:38:22Z</dc:date>
    <item>
      <title>Update a variable’s value based on the value of another variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Update-a-variable-s-value-based-on-the-value-of-another-variable/m-p/990309#M43981</link>
      <description>&lt;P&gt;Hi guys,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;suppose to have the following dataset:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  length Class1 $ 20 Class2 $ 20  Value $20;
  input Class1 Class2   Value ;
cards;
 Blood_disease   Overall           5 
      .          Specific_value    1
 Lung_disease    Overall           3 
      .          Lung_Cancer       1
      .          COPD              1
	  .          RSV               1
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is there a way to get the following?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1;
  length Class1 $ 20 Class2 $ 20  Value $20;
  input Class1 Class2   Value ;
cards;
 Blood_disease   Overall           5 
      .          Specific_value    5
 Lung_disease    Overall           3 
      .          Lung_Cancer       1
      .          COPD              1
	  .          RSV               1
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The dataset have1 comes from previous computations.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you look at Class1 = Lung_disease the Overall value of Class2 is the sum of Lung_Cancer, COPD and RSV Values. This because (by chance) each patient hade one specific disease. For Blood_disease the previous computation counts "Specific_value" only one time although 5 patients had that disease as in "Overall". Is there a way to adjust or correct in order to get have1?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately I cannot modify previous coding.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that only a simplified but realistic version of the dataset is shown. No other particular cases are present.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2026 12:22:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Update-a-variable-s-value-based-on-the-value-of-another-variable/m-p/990309#M43981</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2026-07-01T12:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: Update a variable’s value based on the value of another variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Update-a-variable-s-value-based-on-the-value-of-another-variable/m-p/990319#M43982</link>
      <description>&lt;P&gt;You're analyzing a dataset that is actually a report, not data.&amp;nbsp; It's the same problem as your post last week:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/New-SAS-User/Add-white-row-before-a-variable-value/m-p/990126#M43967" target="_blank"&gt;https://communities.sas.com/t5/New-SAS-User/Add-white-row-before-a-variable-value/m-p/990126#M43967&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you see any logic you could use to derive have1 from have? I think all you could do is hard code it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if Class2="Specific_value" then value=5 ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which is obviously not a solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The correct way to create have1 would be to get access to the data that was the source for these counts.&amp;nbsp; Then you can calculate any count you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2026 12:54:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Update-a-variable-s-value-based-on-the-value-of-another-variable/m-p/990319#M43982</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2026-07-01T12:54:13Z</dc:date>
    </item>
    <item>
      <title>Re: Update a variable’s value based on the value of another variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Update-a-variable-s-value-based-on-the-value-of-another-variable/m-p/990355#M43983</link>
      <description>&lt;P&gt;Agreeing 110% with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;. Reports are not meant for additional SAS data analysis, even if you choose to store them as a SAS data set. We gave you advice in your previous thread, you ignored it, and so now you have additional problems that could have been avoided had you followed our advice. Unfortunately, we see that from many SAS users.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;It would be better if you kept the data in proper SAS data set form so you could continue to analyze it, and also created the report (perhaps saved as a second SAS data set, although this is not required or recommended).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your problem description appears to me to be incomplete. Are we only changing the one row with Class1=. directly under Class1='Blood_disease'? We only change this one row to have the Value in the row above? Could there be more than one row under Blood_disease? Do we ever need to do this with Lung_disease? Are there ever any other diseases mentioned in Class1? If so, what do we do with these? Does your real data have only one patient, or are the multiple patients in your data set that we will need to do this? If there is more than one patient, how would that data set look?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2026 14:14:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Update-a-variable-s-value-based-on-the-value-of-another-variable/m-p/990355#M43983</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2026-07-01T14:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: Update a variable’s value based on the value of another variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Update-a-variable-s-value-based-on-the-value-of-another-variable/m-p/990358#M43984</link>
      <description>&lt;P&gt;No.&amp;nbsp; There is no magic formula to break summarized data into sub categories.&lt;/P&gt;
&lt;P&gt;You will need to go back to the original data and perform the actual counting that you want.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2026 14:38:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Update-a-variable-s-value-based-on-the-value-of-another-variable/m-p/990358#M43984</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-07-01T14:38:22Z</dc:date>
    </item>
  </channel>
</rss>

