<?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: Conditional DROP statement in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Conditional-DROP-statement/m-p/420340#M4174</link>
    <description>&lt;P&gt;Your code will probably work if you add a SET statement so it has input data to work. Otherwise the concept/approach appears correct.&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/177874"&gt;@sastuck&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;New SAS user here. I have many missing observations in my dataset (states which didn't report arrest data according to the codebook), and I am trying to delete these missing observations so that they don't influence my data. The variable of interest is called GRNDTOT. I would like to do something along the lines of:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data paper.arrests_schools_popc;&lt;BR /&gt;if GRNDTOT=0 then delete;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But this isn't working. The key concern here is to make sure the rows and columns remain aligned (rather than truncating the GRNDTOT column (therefore confusing the whole dataset) but to drop the FIPS codes without GRNDTOT data. Any help is appreciated!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAstuck&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Dec 2017 01:32:56 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-12-12T01:32:56Z</dc:date>
    <item>
      <title>Conditional DROP statement</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Conditional-DROP-statement/m-p/420338#M4172</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New SAS user here. I have many missing observations in my dataset (states which didn't report arrest data according to the codebook), and I am trying to delete these missing observations so that they don't influence my data. The variable of interest is called GRNDTOT. I would like to do something along the lines of:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data paper.arrests_schools_popc;&lt;BR /&gt;if GRNDTOT=0 then delete;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this isn't working. The key concern here is to make sure the rows and columns remain aligned (rather than truncating the GRNDTOT column (therefore confusing the whole dataset) but to drop the FIPS codes without GRNDTOT data. Any help is appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAstuck&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 01:31:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Conditional-DROP-statement/m-p/420338#M4172</guid>
      <dc:creator>sastuck</dc:creator>
      <dc:date>2017-12-12T01:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional DROP statement</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Conditional-DROP-statement/m-p/420340#M4174</link>
      <description>&lt;P&gt;Your code will probably work if you add a SET statement so it has input data to work. Otherwise the concept/approach appears correct.&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/177874"&gt;@sastuck&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;New SAS user here. I have many missing observations in my dataset (states which didn't report arrest data according to the codebook), and I am trying to delete these missing observations so that they don't influence my data. The variable of interest is called GRNDTOT. I would like to do something along the lines of:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data paper.arrests_schools_popc;&lt;BR /&gt;if GRNDTOT=0 then delete;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But this isn't working. The key concern here is to make sure the rows and columns remain aligned (rather than truncating the GRNDTOT column (therefore confusing the whole dataset) but to drop the FIPS codes without GRNDTOT data. Any help is appreciated!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAstuck&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 01:32:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Conditional-DROP-statement/m-p/420340#M4174</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-12-12T01:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional DROP statement</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Conditional-DROP-statement/m-p/420371#M4175</link>
      <description>&lt;P&gt;And by missing, you mean 0 values I take it? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your code seems legit. You could also do something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data paper.arrests_schools_popc;
	set YourData(where=(GRNDTOT ne 0));
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>Tue, 12 Dec 2017 06:22:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Conditional-DROP-statement/m-p/420371#M4175</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-12-12T06:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional DROP statement</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Conditional-DROP-statement/m-p/420373#M4176</link>
      <description>&lt;P&gt;Since you posted a word file with a graph in it instead of showing any data it is hard to know exactly what you want.&amp;nbsp; If you want to post a photo of your data using the Photos icon on the menu bar.&amp;nbsp; If you want to post examples of your data use the Insert Code icon instead and post a data step to create a sample of your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your code should DELETE observations where the GRAND_TOTAL variable is zero, but you did not apply it to any data.&amp;nbsp; So you just created an empty dataset with only one variable. (NOTE that DROP is used to eliminate variables, not observations.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But are you sure you don't want to just code the values to missing instead?&amp;nbsp; That way the observation is not deleted just because one variable has a missing value.&amp;nbsp; So if for some reason your original data was coded with zero to represent misisng data then you could use a step like this to convert the zeros to missing values instead.&amp;nbsp; Most SAS procedures will handle missing values.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  set have ;
  if grand_total=0 then grand_total=.;
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>Tue, 12 Dec 2017 06:40:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Conditional-DROP-statement/m-p/420373#M4176</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-12-12T06:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional DROP statement</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Conditional-DROP-statement/m-p/420382#M4177</link>
      <description>&lt;P&gt;Do not use MS Office files for posting code, log or data.&lt;/P&gt;
&lt;P&gt;Convert SAS datasets to a data step by using the macro provided in &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;, and post the resulting code according to the advice in &lt;A href="https://communities.sas.com/t5/help/faqpage/faq-category-id/posting?nobounce" target="_blank"&gt;https://communities.sas.com/t5/help/faqpage/faq-category-id/posting?nobounce&lt;/A&gt;. Use the same method for posting any code, and use the {i} icon for logs or other text that needs a fixed-width font and the formatting (indentation) preserved.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 07:38:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Conditional-DROP-statement/m-p/420382#M4177</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-12-12T07:38:11Z</dc:date>
    </item>
  </channel>
</rss>

