<?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: error variable doesn't exist, but it just doesn't remember it in the output in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/error-variable-doesn-t-exist-but-it-just-doesn-t-remember-it-in/m-p/873053#M38697</link>
    <description>&lt;P&gt;In addition, you can make your coding and typing much easier — there's really no reason to put quotes around 1 and 2, when this would work just as well:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dap1; set epi.hpvd;
if CD4=. then cd=.;
if CD4 lt 500 and cd4 ge 0 then cd =2;
if CD4 ge 500  then cd=1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 30 Apr 2023 10:56:35 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-04-30T10:56:35Z</dc:date>
    <item>
      <title>error variable doesn't exist, but it just doesn't remember it in the output</title>
      <link>https://communities.sas.com/t5/New-SAS-User/error-variable-doesn-t-exist-but-it-just-doesn-t-remember-it-in/m-p/873037#M38694</link>
      <description>&lt;P&gt;I am having trouble in my program using multiple created variables at once. I had created two new variables and when I go to use them, only the most recent one gets saved into my output. When I run an analysis, I get an error code that one does not exist, but it will let me run it if I only run that specific one.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data dap1; set epi.hpvd;
if CD4=. then cd=.;
if CD4 lt 500 and cd4 ge 0 then cd ='2';
if CD4 ge 500  then cd='1';
run;

data dap1; set epi.hpvd;
if hiv_load=. then h=.;
if hiv_load le 75 then h= '1';
if hiv_load gt 75 then h='2';
run;

proc univariate data=dap1;
class cd ;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;PRE class=""&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Apr 2023 04:14:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/error-variable-doesn-t-exist-but-it-just-doesn-t-remember-it-in/m-p/873037#M38694</guid>
      <dc:creator>saslearner14</dc:creator>
      <dc:date>2023-04-30T04:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: error variable doesn't exist, but it just doesn't remember it in the output</title>
      <link>https://communities.sas.com/t5/New-SAS-User/error-variable-doesn-t-exist-but-it-just-doesn-t-remember-it-in/m-p/873040#M38695</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/442274"&gt;@saslearner14&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am having trouble in my program using multiple created variables at once. I had created two new variables and when I go to use them, only the most recent one gets saved into my output. When I run an analysis, I get an error code that one does not exist, but it will let me run it if I only run that specific one.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class=""&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;data dap1; set epi.hpvd;
if CD4=. then cd=.;
if CD4 lt 500 and cd4 ge 0 then cd ='2';
if CD4 ge 500  then cd='1';
run;

data dap1; set epi.hpvd;
if hiv_load=. then h=.;
if hiv_load le 75 then h= '1';
if hiv_load gt 75 then h='2';
run;

proc univariate data=dap1;
class cd ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;PRE class=""&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Your second DATA step overwrites the result dataset from the first. Combine both steps into one:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dap1;
set epi.hpvd;
if 0 le CD4 lt 500
then cd = '2';
else if CD4 ge 500 then cd = '1';
if hiv_load = .
then h = ' ';
else if hiv_load le 75
then h = '1';
else h = '2';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I've also removed one unnecessary IF, created the new variables as character, and optimized your code by using ELSE IF where appropriate.&lt;/P&gt;</description>
      <pubDate>Sun, 30 Apr 2023 05:00:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/error-variable-doesn-t-exist-but-it-just-doesn-t-remember-it-in/m-p/873040#M38695</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-04-30T05:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: error variable doesn't exist, but it just doesn't remember it in the output</title>
      <link>https://communities.sas.com/t5/New-SAS-User/error-variable-doesn-t-exist-but-it-just-doesn-t-remember-it-in/m-p/873041#M38696</link>
      <description>&lt;P&gt;So you made dap1 with the new variable .&lt;/P&gt;
&lt;P&gt;You then overwrote it with a different dataset that makes a different new variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want both variables in the same dataset that either make them both in the SAME data step.&lt;/P&gt;
&lt;P&gt;Or use the output of the first step as the input of the second step.&lt;/P&gt;</description>
      <pubDate>Sun, 30 Apr 2023 05:08:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/error-variable-doesn-t-exist-but-it-just-doesn-t-remember-it-in/m-p/873041#M38696</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-04-30T05:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: error variable doesn't exist, but it just doesn't remember it in the output</title>
      <link>https://communities.sas.com/t5/New-SAS-User/error-variable-doesn-t-exist-but-it-just-doesn-t-remember-it-in/m-p/873053#M38697</link>
      <description>&lt;P&gt;In addition, you can make your coding and typing much easier — there's really no reason to put quotes around 1 and 2, when this would work just as well:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dap1; set epi.hpvd;
if CD4=. then cd=.;
if CD4 lt 500 and cd4 ge 0 then cd =2;
if CD4 ge 500  then cd=1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Apr 2023 10:56:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/error-variable-doesn-t-exist-but-it-just-doesn-t-remember-it-in/m-p/873053#M38697</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-04-30T10:56:35Z</dc:date>
    </item>
  </channel>
</rss>

