<?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: If condition in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/If-condition/m-p/79794#M17188</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes. I would like to group all the ones with 5 and less than 5 into one "OTHER"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AND also what you see is not my actual dataset.Its the dataset after I did the freq......&lt;/P&gt;&lt;P&gt;I need to make these changes in my Parent dataset.&lt;/P&gt;&lt;P&gt;I just did a freq to see how many are less than 5!!!&lt;/P&gt;&lt;P&gt;AND I HAVE SEVERAL HUNDREDS OF THOSE WITH LESS THAN 5 Making it difficult for me to use the IF condition&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 26 Nov 2012 01:04:31 GMT</pubDate>
    <dc:creator>robertrao</dc:creator>
    <dc:date>2012-11-26T01:04:31Z</dc:date>
    <item>
      <title>If condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-condition/m-p/79792#M17186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;I have a dataset and did a proc freq of &lt;STRONG&gt;Code*description&lt;/STRONG&gt; and i get what is shown below&lt;/P&gt;&lt;P&gt;I want to put OTHER in the description column for those which have a count of 5 or less&lt;/P&gt;&lt;P&gt;I should get like shown below if I did the freq of the dataset&lt;/P&gt;&lt;P&gt;Code&amp;nbsp; Description Freq Count&lt;/P&gt;&lt;P&gt;000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OTHER&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have several hunderds which have count less than 5&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I cannot write IF condition for several hunderds in the parent dataset like:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;if Description in ("Urinary", "Heart" ,"nose" "head"," hand"," finger"," toes") then do;&lt;/P&gt;&lt;P&gt;Description="Other";&lt;/P&gt;&lt;P&gt;code="000";&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;Please help me with the best solution&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code&amp;nbsp;&amp;nbsp;&amp;nbsp; Decription&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; freq count&lt;/P&gt;&lt;P&gt;100&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pain&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15&lt;/P&gt;&lt;P&gt;101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; urinary&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;/P&gt;&lt;P&gt;102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; digestive&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 33&lt;/P&gt;&lt;P&gt;103&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; heart&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;&lt;P&gt;104&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nerves&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 55&lt;/P&gt;&lt;P&gt;105&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nose&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;106&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; head&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&lt;/P&gt;&lt;P&gt;107&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; leg&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 45&lt;/P&gt;&lt;P&gt;108&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hand&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;&lt;P&gt;109&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; finger&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&lt;/P&gt;&lt;P&gt;110&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; toes&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 25 Nov 2012 23:57:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-condition/m-p/79792#M17186</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2012-11-25T23:57:45Z</dc:date>
    </item>
    <item>
      <title>Re: If condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-condition/m-p/79793#M17187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if count&amp;lt;5 then description='Other' ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or would you like to group all the ones with less than 5 individually together into one 'Other'?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Nov 2012 00:38:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-condition/m-p/79793#M17187</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-11-26T00:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: If condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-condition/m-p/79794#M17188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes. I would like to group all the ones with 5 and less than 5 into one "OTHER"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AND also what you see is not my actual dataset.Its the dataset after I did the freq......&lt;/P&gt;&lt;P&gt;I need to make these changes in my Parent dataset.&lt;/P&gt;&lt;P&gt;I just did a freq to see how many are less than 5!!!&lt;/P&gt;&lt;P&gt;AND I HAVE SEVERAL HUNDREDS OF THOSE WITH LESS THAN 5 Making it difficult for me to use the IF condition&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Nov 2012 01:04:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-condition/m-p/79794#M17188</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2012-11-26T01:04:31Z</dc:date>
    </item>
    <item>
      <title>Re: If condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-condition/m-p/79795#M17189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Then use the proc freq output to feed a lookup table so its dynamic and you aren't using an if. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ie &lt;/P&gt;&lt;P&gt;proc freq data=have;&lt;/P&gt;&lt;P&gt;table code*description/out=list_format;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data list_format;&lt;/P&gt;&lt;P&gt;set list_format;&lt;/P&gt;&lt;P&gt;if count&amp;lt;= 5 then do;&lt;/P&gt;&lt;P&gt;new_description='Other';&lt;/P&gt;&lt;P&gt;new_code=999; *so it will sort last;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;else do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new_description=description&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new_code=code;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;drop count;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=have; by code description;&lt;/P&gt;&lt;P&gt;proc sort data=list_fmt; by code description;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;merge have list_fmt;&lt;/P&gt;&lt;P&gt;by code description;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Nov 2012 01:30:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-condition/m-p/79795#M17189</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-11-26T01:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: If condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-condition/m-p/79796#M17190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;I understood the logic.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG&gt;S&lt;/STRONG&gt;&lt;/STRONG&gt;o after merging the datasets we consider the new_code and new_description for Proc Freq purpose RIGHT????&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Secondly,&lt;/P&gt;&lt;P&gt;When we converted to new_code code which was 001 is getting translated to 1(no leading zeros)&lt;/P&gt;&lt;P&gt;Is there any way i could retain the leading zeros???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Nov 2012 02:06:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-condition/m-p/79796#M17190</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2012-11-26T02:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: If condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-condition/m-p/79797#M17191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;New_code is defined as numeric in the example.&lt;/P&gt;&lt;P&gt;For printing with leading zeros in a report, use z. format.&lt;/P&gt;&lt;P&gt;Otherwise, define it as char instead.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Nov 2012 09:06:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-condition/m-p/79797#M17191</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2012-11-26T09:06:08Z</dc:date>
    </item>
  </channel>
</rss>

