<?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: Delete Certain Observations in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Delete-Certain-Observations/m-p/776370#M31382</link>
    <description>&lt;P&gt;Start by cleaning up the errors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The FORMAT statement ends when it encounters a semicolon.&amp;nbsp; So you have an extra semicolon that should be removed from here:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;FORMAT 
        redcap_event_name $redcap_event_name_.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;since you actually want the FORMAT statement to end here:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;        informed_consent_hip_v_1  informed_consent_hip_v_1_.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also important, it appears that SAS objects to your WHERE statement.&amp;nbsp; Start by confirming whether INFORMED_CONSENT_HIP_V_1_ and INFORMED_CONSENT_HIP_V_0_ are numeric or character.&amp;nbsp; For a numeric variable, checking ="0" would be incorrect (the quotes should be removed).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Oct 2021 06:27:02 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2021-10-26T06:27:02Z</dc:date>
    <item>
      <title>Delete Certain Observations</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Delete-Certain-Observations/m-p/776338#M31379</link>
      <description>&lt;P&gt;I'd like to delete observations where the following conditions are met:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;redcap_event_name = "baseline"&lt;/P&gt;
&lt;P&gt;informed_consent_hip_v_0 is missing&lt;/P&gt;
&lt;P&gt;informed_consent_hip_v_1 = "incomplete"&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2021-10-25 at 5.40.48 PM.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65024iD3D93D31C8E2EB32/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2021-10-25 at 5.40.48 PM.png" alt="Screen Shot 2021-10-25 at 5.40.48 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I've tried if-then-delete and where clauses and can't figure it out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 00:50:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Delete-Certain-Observations/m-p/776338#M31379</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2021-10-26T00:50:04Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Certain Observations</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Delete-Certain-Observations/m-p/776339#M31380</link>
      <description>&lt;P&gt;Do you have any formats applied to this table? I ask because this variable "&lt;SPAN&gt;informed_consent_hip_v_1" appears to be numeric, so you may need that numeric value for which "Incomplete" is the format.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;SVH&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 01:02:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Delete-Certain-Observations/m-p/776339#M31380</guid>
      <dc:creator>svh</dc:creator>
      <dc:date>2021-10-26T01:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Certain Observations</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Delete-Certain-Observations/m-p/776352#M31381</link>
      <description>&lt;P&gt;Yes, there are formats, but I still can't figure it out. I don't understand the format for "redcap_event_name_".&amp;nbsp;Thanks again for your help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data kb_data;
	set redcap;
        
        WHERE redcap_event_name = "baseline_arm_1";
        WHERE SAME AND informed_consent_hip_v_1 = "0";
        WHERE SAME AND informed_consent_hip_v_0 is missing; 
   
        FORMAT 
        redcap_event_name $redcap_event_name_.;
/*         value $redcap_event_name_ baseline_arm_1='baseline' fu_1_arm_1='fu_1' fu_2_arm_1='fu_2'; */

        informed_consent_hip_v_1  informed_consent_hip_v_1_.;
/*         value informed_consent_hip_v_1_ 0='Incomplete' 1='Unverified' 2='Complete'; */

/* 		informed_consent_hip_v_0 does not have a format */
 run;
&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2021-10-25 at 7.29.28 PM.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65025i370A2EB9773A16A2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screen Shot 2021-10-25 at 7.29.28 PM.png" alt="Screen Shot 2021-10-25 at 7.29.28 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 02:30:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Delete-Certain-Observations/m-p/776352#M31381</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2021-10-26T02:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Certain Observations</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Delete-Certain-Observations/m-p/776370#M31382</link>
      <description>&lt;P&gt;Start by cleaning up the errors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The FORMAT statement ends when it encounters a semicolon.&amp;nbsp; So you have an extra semicolon that should be removed from here:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;FORMAT 
        redcap_event_name $redcap_event_name_.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;since you actually want the FORMAT statement to end here:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;        informed_consent_hip_v_1  informed_consent_hip_v_1_.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also important, it appears that SAS objects to your WHERE statement.&amp;nbsp; Start by confirming whether INFORMED_CONSENT_HIP_V_1_ and INFORMED_CONSENT_HIP_V_0_ are numeric or character.&amp;nbsp; For a numeric variable, checking ="0" would be incorrect (the quotes should be removed).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 06:27:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Delete-Certain-Observations/m-p/776370#M31382</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-10-26T06:27:02Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Certain Observations</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Delete-Certain-Observations/m-p/776371#M31383</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/36911"&gt;@_maldini_&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Yes, there are formats, but I still can't figure it out. I don't understand the format for "redcap_event_name_".&amp;nbsp;Thanks again for your help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data kb_data;
	set redcap;
        
        WHERE redcap_event_name = "baseline_arm_1";
        WHERE SAME AND informed_consent_hip_v_1 = "0";
        WHERE SAME AND informed_consent_hip_v_0 is missing; 
   
        FORMAT 
        redcap_event_name $redcap_event_name_.;
/*         value $redcap_event_name_ baseline_arm_1='baseline' fu_1_arm_1='fu_1' fu_2_arm_1='fu_2'; */

        informed_consent_hip_v_1  informed_consent_hip_v_1_.;
/*         value informed_consent_hip_v_1_ 0='Incomplete' 1='Unverified' 2='Complete'; */

/* 		informed_consent_hip_v_0 does not have a format */
 run;
&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2021-10-25 at 7.29.28 PM.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65025i370A2EB9773A16A2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screen Shot 2021-10-25 at 7.29.28 PM.png" alt="Screen Shot 2021-10-25 at 7.29.28 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Your error messages are because the variable you are using is numeric and you compare it to a character value. When you place digits inside quotes you are intending a CHARACTER comparison. Try = 0;&lt;/P&gt;
&lt;P&gt;The second error is because the semicolon after&lt;/P&gt;
&lt;PRE&gt; redcap_event_name $redcap_event_name_.;&lt;/PRE&gt;
&lt;P&gt;ends the Format statement. Remove the ; there and the error should go away.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In future when posting LOG information it is better to copy the log text for the entire procedure or data step, open a text box using the &amp;lt;/&amp;gt; and paste the text.&lt;/P&gt;
&lt;P&gt;It is very hard to deal with pictures of text. Can't copy/paste, make corrections or such.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 06:31:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Delete-Certain-Observations/m-p/776371#M31383</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-10-26T06:31:21Z</dc:date>
    </item>
  </channel>
</rss>

