<?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: Using SAS studio trying to delete observations in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Using-SAS-studio-trying-to-delete-observations/m-p/702082#M9533</link>
    <description>&lt;P&gt;This instead&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data nsch1718;
set mc759.nsch1718combined_drc;
if 2 &amp;lt; SC_AGE_YEARS &amp;lt;= 5;
keep ACEct_1718 PrntNativity_1718 TalkAbout_1718 WrkToSolve_1718 strengths_1718 hopeful_1718 CtFamRes_1718 FamResilience_1718 
confident_1718 ACEdivorce_1718 ACEdeath_1718 ACEjail_1718 ACEdomviol_1718 ACEneighviol_1718 ACEmhealth_1718 ACEdrug_1718 ACEdiscrim_1718
sex_1718 SC_AGE_YEARS SC_HISPANIC_R SC_RACE_R raceAsia_1718 povSCHIP_1718 FPL_I1 AdultEduc_1718 FamCount_1718 RecogLetter_1718 
CountTo_1718 CONFIDENT WorkToFin_1718 HurtSad_1718 WriteName_1718;
format CONFIDENT confidentf. prntnativity_1718 prntnativityf. confident_1718 confidentf.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 27 Nov 2020 18:07:52 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2020-11-27T18:07:52Z</dc:date>
    <item>
      <title>Using SAS studio trying to delete observations</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Using-SAS-studio-trying-to-delete-observations/m-p/702065#M9530</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working with a large dataset and trying to subset the data to only keep certain variables, I am only looking at a certain age range for the data too so I want to delete the ages that I do not need. My code for this isn't working and I'm not sure why.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data nsch1718;
if  2=&amp;gt;SC_AGE_YEARS&amp;gt;5 then delete;
keep ACEct_1718 PrntNativity_1718 TalkAbout_1718 WrkToSolve_1718 strengths_1718 hopeful_1718 CtFamRes_1718 FamResilience_1718 
confident_1718 ACEdivorce_1718 ACEdeath_1718 ACEjail_1718 ACEdomviol_1718 ACEneighviol_1718 ACEmhealth_1718 ACEdrug_1718 ACEdiscrim_1718
sex_1718 SC_AGE_YEARS SC_HISPANIC_R SC_RACE_R raceAsia_1718 povSCHIP_1718 FPL_I1 AdultEduc_1718 FamCount_1718 RecogLetter_1718 
CountTo_1718 CONFIDENT WorkToFin_1718 HurtSad_1718 WriteName_1718;
format CONFIDENT confidentf. prntnativity_1718 prntnativityf. confident_1718 confidentf.;
set mc759.nsch1718combined_drc;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Nov 2020 17:07:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Using-SAS-studio-trying-to-delete-observations/m-p/702065#M9530</guid>
      <dc:creator>ayosas</dc:creator>
      <dc:date>2020-11-27T17:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: Using SAS studio trying to delete observations</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Using-SAS-studio-trying-to-delete-observations/m-p/702076#M9531</link>
      <description>&lt;P&gt;Because your SET statement is after all your code. It needs to be BEFORE the logic you want to execute. Otherwise you're referencing values that don't exist yet.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data nsch1718;
set mc759.nsch1718combined_drc;&lt;BR /&gt;
if 2=&amp;gt;SC_AGE_YEARS&amp;gt;5 then delete;&lt;BR /&gt;
keep ACEct_1718 PrntNativity_1718 TalkAbout_1718 WrkToSolve_1718 strengths_1718 hopeful_1718 CtFamRes_1718 FamResilience_1718 
confident_1718 ACEdivorce_1718 ACEdeath_1718 ACEjail_1718 ACEdomviol_1718 ACEneighviol_1718 ACEmhealth_1718 ACEdrug_1718 ACEdiscrim_1718
sex_1718 SC_AGE_YEARS SC_HISPANIC_R SC_RACE_R raceAsia_1718 povSCHIP_1718 FPL_I1 AdultEduc_1718 FamCount_1718 RecogLetter_1718 
CountTo_1718 CONFIDENT WorkToFin_1718 HurtSad_1718 WriteName_1718;&lt;BR /&gt;
format CONFIDENT confidentf. prntnativity_1718 prntnativityf. confident_1718 confidentf.;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;If this doesn't work, post the log from the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a reference that illustrates how to refer to variables and datasets in a short cut list:&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2018/05/29/6-easy-ways-to-specify-a-list-of-variables-in-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2018/05/29/6-easy-ways-to-specify-a-list-of-variables-in-sas.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/349418"&gt;@ayosas&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am working with a large dataset and trying to subset the data to only keep certain variables, I am only looking at a certain age range for the data too so I want to delete the ages that I do not need. My code for this isn't working and I'm not sure why.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data nsch1718;
if  2=&amp;gt;SC_AGE_YEARS&amp;gt;5 then delete;
keep ACEct_1718 PrntNativity_1718 TalkAbout_1718 WrkToSolve_1718 strengths_1718 hopeful_1718 CtFamRes_1718 FamResilience_1718 
confident_1718 ACEdivorce_1718 ACEdeath_1718 ACEjail_1718 ACEdomviol_1718 ACEneighviol_1718 ACEmhealth_1718 ACEdrug_1718 ACEdiscrim_1718
sex_1718 SC_AGE_YEARS SC_HISPANIC_R SC_RACE_R raceAsia_1718 povSCHIP_1718 FPL_I1 AdultEduc_1718 FamCount_1718 RecogLetter_1718 
CountTo_1718 CONFIDENT WorkToFin_1718 HurtSad_1718 WriteName_1718;
format CONFIDENT confidentf. prntnativity_1718 prntnativityf. confident_1718 confidentf.;
set mc759.nsch1718combined_drc;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Nov 2020 17:44:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Using-SAS-studio-trying-to-delete-observations/m-p/702076#M9531</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-11-27T17:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: Using SAS studio trying to delete observations</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Using-SAS-studio-trying-to-delete-observations/m-p/702077#M9532</link>
      <description>&lt;P&gt;The "if" has to come after the SET. Otherwise there are no values to compare.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please describe the ages that you want to keep.&lt;/P&gt;
&lt;P&gt;When you say Age &amp;gt; 5 then the 2&amp;gt;= age will never be true so the compound comparison will not find any records. (2 not being larger than 5)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to keep records with the age between 2 and 5 this is more likely.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If 2 &amp;lt;= age &amp;lt;=5 ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;An If of this form is called a subsetting if and only records with the comparison true are kept.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Nov 2020 17:29:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Using-SAS-studio-trying-to-delete-observations/m-p/702077#M9532</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-11-27T17:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using SAS studio trying to delete observations</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Using-SAS-studio-trying-to-delete-observations/m-p/702082#M9533</link>
      <description>&lt;P&gt;This instead&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data nsch1718;
set mc759.nsch1718combined_drc;
if 2 &amp;lt; SC_AGE_YEARS &amp;lt;= 5;
keep ACEct_1718 PrntNativity_1718 TalkAbout_1718 WrkToSolve_1718 strengths_1718 hopeful_1718 CtFamRes_1718 FamResilience_1718 
confident_1718 ACEdivorce_1718 ACEdeath_1718 ACEjail_1718 ACEdomviol_1718 ACEneighviol_1718 ACEmhealth_1718 ACEdrug_1718 ACEdiscrim_1718
sex_1718 SC_AGE_YEARS SC_HISPANIC_R SC_RACE_R raceAsia_1718 povSCHIP_1718 FPL_I1 AdultEduc_1718 FamCount_1718 RecogLetter_1718 
CountTo_1718 CONFIDENT WorkToFin_1718 HurtSad_1718 WriteName_1718;
format CONFIDENT confidentf. prntnativity_1718 prntnativityf. confident_1718 confidentf.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Nov 2020 18:07:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Using-SAS-studio-trying-to-delete-observations/m-p/702082#M9533</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-11-27T18:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using SAS studio trying to delete observations</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Using-SAS-studio-trying-to-delete-observations/m-p/702083#M9534</link>
      <description>Thank you!!</description>
      <pubDate>Fri, 27 Nov 2020 18:09:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Using-SAS-studio-trying-to-delete-observations/m-p/702083#M9534</guid>
      <dc:creator>ayosas</dc:creator>
      <dc:date>2020-11-27T18:09:51Z</dc:date>
    </item>
  </channel>
</rss>

