<?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: Issues with generating new variables - my code is writing over them in the dataset in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Issues-with-generating-new-variables-my-code-is-writing-over/m-p/819349#M34726</link>
    <description>Thank you, that is exactly what I was doing wrong! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;T.</description>
    <pubDate>Tue, 21 Jun 2022 15:13:37 GMT</pubDate>
    <dc:creator>SAS_Novice22</dc:creator>
    <dc:date>2022-06-21T15:13:37Z</dc:date>
    <item>
      <title>Issues with generating new variables - my code is writing over them in the dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Issues-with-generating-new-variables-my-code-is-writing-over/m-p/819198#M34716</link>
      <description>&lt;P&gt;Hi SAS Experts,&lt;/P&gt;&lt;P&gt;I am trying to evaluate inclusion/exclusion criteria for a study and the way my data is set up requires me to take a number of steps to get at what I would like.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I ultimately want to know who is eligible (i.e., they met the 2 inclusion criteria and did not meet any of the 3 exclusion criteria). Each criteria is its own variable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I feel my SAS code is solid in getting at what I want however, my problem occurs early on in that the variables I am attempting to generate keep getting written over. What am I doing wrong? Here is my SAS code below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;/**Eligibility Part B Inclusion Criteria**/

DATA WORK.IEB2;
	SET IEB;
	INCLU1_YES = .;
	INCLU2_YES = .;
RUN;

/**Eligibility Part B - INCLUSION #1**/

DATA WORK.IEB2;
	SET IEB;
	IF IC01R_DEC="Yes" OR IC01L_DEC="Yes" THEN INCLU1_YES=1;
	ELSE INCLU1_YES = 0;
RUN;

/**Eligibility Part B - INCLUSION #2**/
DATA WORK.IEB2;
	SET IEB;
	IF IC02R_DEC="Yes" OR IC02L_DEC="Yes" THEN INCLU2_YES=1;
	ELSE INCLU2_YES = 0;
RUN;

DATA WORK.IEB2;
	SET IEB;
	IF INCLU1_YES=1 AND INCLU2_YES=1 THEN INCLUSION_YES=1;
	ELSE INCLUSION_YES = 0;
RUN;

TITLE "Eligibility Part 2 - Count of how many met/did not meet inclusion criteria Overall"; 
PROC FREQ DATA=WORK.IEB2;
	TABLES OVERALL*ELIG_YES;
RUN;

/**Eligibility Part B Exclusion Criteria**/
DATA WORK.IEB2;
	SET IEB;
	EXCLU1_YES = .;
	EXCLU2_YES = .;
	EXCLU3_YES = .;
RUN;

/**Eligibility Part B - EXCLUSION #1**/
DATA WORK.IEB2;
	SET IEB;
	IF EX01R_DEC="Yes" OR EX01L_DEC="Yes" THEN EXCLU1_YES=1;
	ELSE EXCLU1_YES = 0;
RUN;

/**Eligibility Part B - EXCLUSION #2**/
DATA WORK.IEB2;
	SET IEB;
	IF EX02R_DEC="Yes" OR EX02L_DEC="Yes" THEN EXCLU2_YES=1;
	ELSE EXCLU2_YES = 0;
RUN;

/**Eligibility Part B - EXCLUSION #3**/
DATA WORK.IEB2;
	SET IEB;
	IF EX03_DEC="Yes" THEN EXCLU3_YES=1;
	ELSE EXCLU3_YES = 0;
RUN;

DATA WORK.IEB2;
	SET IEB;
	IF EXCLU1_YES=1 OR EXCLU2_YES=1 OR EXCLU3_YES=1 THEN EXCLUDED_YES=1;
	ELSE EXCLUDED_YES = 0;
RUN;

TITLE "Eligibility Part 2 - Count of how many were excluded due to exclusion criteria Overall"; 
PROC FREQ DATA=WORK.IEB2;
	TABLES OVERALL*EXCLUDED_YES;
RUN;

DATA WORK.IEB2;
	SET IEB;
	IF INCLUSION_YES=1 AND EXCLUDED_YES=0 THEN ELIG_YES=1;
	ELSE ELIG_YES = 0;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I am not getting any SAS error messages - but the problem is occuring when I attempt to generate and reclassify the following variables.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;DATA WORK.IEB2;
	SET IEB;
	EXCLU1_YES = .;
	EXCLU2_YES = .;
	EXCLU3_YES = .;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;T.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2022 19:41:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Issues-with-generating-new-variables-my-code-is-writing-over/m-p/819198#M34716</guid>
      <dc:creator>SAS_Novice22</dc:creator>
      <dc:date>2022-06-20T19:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with generating new variables - my code is writing over them in the dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Issues-with-generating-new-variables-my-code-is-writing-over/m-p/819207#M34720</link>
      <description>&lt;P&gt;Why do you keep sourcing the original dataset instead of the modified dataset?&lt;/P&gt;
&lt;P&gt;Your first step is reading from IEB to create IEB2.&lt;/P&gt;
&lt;P&gt;Your second step is reading from IEB to re-create IEB2 (removing the version made in the previous step).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why not just re-write the steps to take IEB and generate IEB2 and then take IEB2 and generate IEB3 etc untill you get what you want?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2022 21:16:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Issues-with-generating-new-variables-my-code-is-writing-over/m-p/819207#M34720</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-20T21:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with generating new variables - my code is writing over them in the dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Issues-with-generating-new-variables-my-code-is-writing-over/m-p/819209#M34721</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA WORK.IEB2;
	SET IEB;
       *not needed;
	INCLU1_YES = .;
	INCLU2_YES = .;


/**Eligibility Part B - INCLUSION #1**/

	IF IC01R_DEC="Yes" OR IC01L_DEC="Yes" THEN INCLU1_YES=1;
	ELSE INCLU1_YES = 0;

/**Eligibility Part B - INCLUSION #2**/

	IF IC02R_DEC="Yes" OR IC02L_DEC="Yes" THEN INCLU2_YES=1;
	ELSE INCLU2_YES = 0;



	IF INCLU1_YES=1 AND INCLU2_YES=1 THEN INCLUSION_YES=1;
	ELSE INCLUSION_YES = 0;

RUN;

TITLE "Eligibility Part 2 - Count of how many met/did not meet inclusion criteria Overall"; 
PROC FREQ DATA=WORK.IEB2;
	TABLES OVERALL*ELIG_YES;
RUN;

/**Eligibility Part B Exclusion Criteria**/
DATA WORK.IEB3;
	SET IEB2;
	EXCLU1_YES = .;
	EXCLU2_YES = .;
	EXCLU3_YES = .;


/**Eligibility Part B - EXCLUSION #1**/

	IF EX01R_DEC="Yes" OR EX01L_DEC="Yes" THEN EXCLU1_YES=1;
	ELSE EXCLU1_YES = 0;


/**Eligibility Part B - EXCLUSION #2**/

	IF EX02R_DEC="Yes" OR EX02L_DEC="Yes" THEN EXCLU2_YES=1;
	ELSE EXCLU2_YES = 0;


/**Eligibility Part B - EXCLUSION #3**/

	IF EX03_DEC="Yes" THEN EXCLU3_YES=1;
	ELSE EXCLU3_YES = 0;

	IF EXCLU1_YES=1 OR EXCLU2_YES=1 OR EXCLU3_YES=1 THEN EXCLUDED_YES=1;
	ELSE EXCLUDED_YES = 0;
RUN;

TITLE "Eligibility Part 2 - Count of how many were excluded due to exclusion criteria Overall"; 
PROC FREQ DATA=WORK.IEB3;
	TABLES OVERALL*EXCLUDED_YES;
RUN;

DATA WORK.IEB4;
	SET IEB3;
	IF INCLUSION_YES=1 AND EXCLUDED_YES=0 THEN ELIG_YES=1;
	ELSE ELIG_YES = 0;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Pay more attention to your INPUT and OUTPUT data set name and how the flow. If you track them throughout the process you should be able to see the errors.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2022 21:41:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Issues-with-generating-new-variables-my-code-is-writing-over/m-p/819209#M34721</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-06-20T21:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with generating new variables - my code is writing over them in the dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Issues-with-generating-new-variables-my-code-is-writing-over/m-p/819348#M34725</link>
      <description>Thank you, that is exactly what I was doing! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;T.</description>
      <pubDate>Tue, 21 Jun 2022 15:12:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Issues-with-generating-new-variables-my-code-is-writing-over/m-p/819348#M34725</guid>
      <dc:creator>SAS_Novice22</dc:creator>
      <dc:date>2022-06-21T15:12:49Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with generating new variables - my code is writing over them in the dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Issues-with-generating-new-variables-my-code-is-writing-over/m-p/819349#M34726</link>
      <description>Thank you, that is exactly what I was doing wrong! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;T.</description>
      <pubDate>Tue, 21 Jun 2022 15:13:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Issues-with-generating-new-variables-my-code-is-writing-over/m-p/819349#M34726</guid>
      <dc:creator>SAS_Novice22</dc:creator>
      <dc:date>2022-06-21T15:13:37Z</dc:date>
    </item>
  </channel>
</rss>

