<?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 THEN command in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/IF-THEN-command/m-p/99271#M9635</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And, some procedures have a WEIGHT option or WEIGHT statement. So sometimes, the syntax checker will flag those as red, but the code will execute correctly. Without seeing ALL of your code, it is hard to speculate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should not confuse macro syntax %IF with data step "regular" IF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 04 Aug 2013 17:59:25 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2013-08-04T17:59:25Z</dc:date>
    <item>
      <title>IF THEN command</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/IF-THEN-command/m-p/99269#M9633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure what but anytime I types the following command it highlight in red&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; line-height: 115%; font-family: 'Courier New'; font-size: 10pt;"&gt;if weight=999 then weight=.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; line-height: 115%; font-family: 'Courier New'; font-size: 10pt;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; line-height: 115%; font-family: 'Courier New'; font-size: 10pt;"&gt;or&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 115%; color: black; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;if weight=999 then weight=.; and hit run&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 115%; color: black; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;I tired %if weight=999 %then weight=.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 115%; color: black; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;Any help please&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Aug 2013 00:53:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/IF-THEN-command/m-p/99269#M9633</guid>
      <dc:creator>Edwinl</dc:creator>
      <dc:date>2013-08-04T00:53:47Z</dc:date>
    </item>
    <item>
      <title>Re: IF THEN command</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/IF-THEN-command/m-p/99270#M9634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nothing wrong with the statement as such.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does below code work for you?&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set sashelp.class;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if weight=999 then weight=.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There might be something wrong in your code before this statement. That's why you would need to post the full data step - or the procedure code if this is Proc Report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And: Which client is this? EG? And which version?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Aug 2013 01:06:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/IF-THEN-command/m-p/99270#M9634</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2013-08-04T01:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: IF THEN command</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/IF-THEN-command/m-p/99271#M9635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And, some procedures have a WEIGHT option or WEIGHT statement. So sometimes, the syntax checker will flag those as red, but the code will execute correctly. Without seeing ALL of your code, it is hard to speculate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should not confuse macro syntax %IF with data step "regular" IF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Aug 2013 17:59:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/IF-THEN-command/m-p/99271#M9635</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2013-08-04T17:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: IF THEN command</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/IF-THEN-command/m-p/99272#M9636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV class="c proctitle"&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; proc data=DMC_data.cholesterol;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;var weight;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;The MEANS Procedure&lt;/DIV&gt;&lt;P&gt; N&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; means&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Std dev&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; minimum&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; maximum&lt;/P&gt;&lt;DIV&gt;&lt;TABLE cellpadding="5" cellspacing="0" class="table" frame="box" rules="all" summary="Procedure Means: Summary statistics"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="r data"&gt;200&lt;/TD&gt;&lt;TD class="r data"&gt;172.3750000&lt;/TD&gt;&lt;TD class="r data"&gt;64.5029264&lt;/TD&gt;&lt;TD class="r data"&gt;109.0000000&lt;/TD&gt;&lt;TD class="r data"&gt;999.0000000&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;P&gt; then I did&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)&lt;/P&gt;&lt;P&gt;if weight =999 then weight=.;&lt;/P&gt;&lt;P&gt;and run the above proc procedure and still 999 was not replaces and if was highlighted in red.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I then tried the suggested syntax&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set sashelp.class;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if weight=999 then weight=.;&lt;/P&gt;&lt;P&gt;followed by the above proc syntax and still 999 wasn't replaced.&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3)&lt;/P&gt;&lt;P&gt;proc data=DMC_data.cholesterol;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;var weight;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;if weight=999 then weight=.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Aug 2013 02:49:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/IF-THEN-command/m-p/99272#M9636</guid>
      <dc:creator>Edwinl</dc:creator>
      <dc:date>2013-08-10T02:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: IF THEN command</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/IF-THEN-command/m-p/99273#M9637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to invest some time in skilling up and understand the SAS concept of a Data Step and a Procedure.&lt;/P&gt;&lt;P&gt;Also consider using the EG wizards as this will support you in creating valid SAS code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To give you a start below a simple example how your code could look like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;BR /&gt;&amp;nbsp; set DMC_data.cholesterol;&lt;BR /&gt;&amp;nbsp; if weight=999 then weight=.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc means data=test;&lt;BR /&gt;&amp;nbsp; var weight;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Aug 2013 03:31:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/IF-THEN-command/m-p/99273#M9637</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2013-08-10T03:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: IF THEN command</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/IF-THEN-command/m-p/99274#M9638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;2) A) Cannot work as you cannot use an IF statement without some context to tell what to operate on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; B) Worked fine, but because you told it to throw away the output of the data step (data _null_;) it will have no effect other than to test the syntax of your IF statement&lt;/P&gt;&lt;P&gt;3) You cannot use an IF statement in a PROC.&amp;nbsp; You could use a WHERE statement to eliminate the WEIGHT=999 records from the data. (where weight ne 999;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You probably need to add a step some where to recode your special missing values from valid numbers like 999 into SAS missing or special missing values.&amp;nbsp; I would recommend doing this in the first step that reads in your data from the source (if you cannot modify it in the source).&amp;nbsp; Perhaps you are used to using SPSS which has support for indicating that normal values are to be treated as missing.&amp;nbsp; SPSS also has an implied data step for every analysis procedure that support using things like IF statements and other code that can transform the data before it is passed to the analysis algorithm.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Aug 2013 15:43:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/IF-THEN-command/m-p/99274#M9638</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-08-10T15:43:35Z</dc:date>
    </item>
    <item>
      <title>Re: IF THEN command</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/IF-THEN-command/m-p/99275#M9639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom&lt;BR /&gt;You are right to aim at some basics. It are the concepts to be reviewed: &lt;A href="http://support.sas.com/documentation/onlinedoc/bookshelf/93/desktop.html" title="http://support.sas.com/documentation/onlinedoc/bookshelf/93/desktop.html"&gt;SAS 9.3 Programmer's Bookshelf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some nasty things:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1/ Missings&lt;BR /&gt;For statisticians it it quite common and makes sense to have many of them with different meanings.&lt;/P&gt;&lt;P&gt;- The SQL concept is failing in this part, just having one value "missing".&lt;/P&gt;&lt;P&gt;- SAS SPSS Stata (and others) are solving that it in different ways but supporting that. &lt;/P&gt;&lt;P&gt;&amp;nbsp; SAS has the option to work with many types: &lt;A href="http://support.sas.com/documentation/cdl/en/lestmtsref/63323/HTML/default/viewer.htm#n0ewjmosjtyjbtn1t5zabfkrof4f.htm" title="http://support.sas.com/documentation/cdl/en/lestmtsref/63323/HTML/default/viewer.htm#n0ewjmosjtyjbtn1t5zabfkrof4f.htm"&gt;SAS(R) 9.3 Statements: Reference&lt;/A&gt; (missing).&lt;/P&gt;&lt;P&gt;-&amp;nbsp; The 9 habit as used in surveys is something going back to the hollerith approach, just having the numbers 0-9 as options.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; That time has passed but habits are &lt;SPAN class="hps alt-edited"&gt;pertinacious&lt;/SPAN&gt;. At the data-cleansing step this should solved, adjusted &lt;/P&gt;&lt;P&gt;an old proceedng &lt;A href="http://www.nesug.org/proceedings/nesug01/ps/ps8009.pdf" title="http://www.nesug.org/proceedings/nesug01/ps/ps8009.pdf"&gt;http://www.nesug.org/proceedings/nesug01/ps/ps8009.pdf&lt;/A&gt; &lt;/P&gt;&lt;P&gt;And (stata) &lt;A href="http://www.ats.ucla.edu/stat/stata/faq/missing_mvencode.htm" title="http://www.ats.ucla.edu/stat/stata/faq/missing_mvencode.htm"&gt;Stata FAQ: How can I recode missing values into different categories?&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2/ Formats&lt;/P&gt;&lt;P&gt;Nothing is what is what is seems to be. The numeric (floating) technical handling is rather basic as some quirks can pop-up.&lt;/P&gt;&lt;P&gt;The rounding and difference with integers is a pitfall.&amp;nbsp; Dates Times and datetimes are challenging. Unicode for the next frontier.&lt;/P&gt;&lt;P&gt;The concept of formats is rather unique with SAS. It is the only one environment/language I have seen where this is a segregated part of the data and can be seperately maintained. This offers quite smart and simple approaches not well known. &lt;A href="http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#p1xidhqypi0fnwn1if8opjpqpbmn.htm" title="http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#p1xidhqypi0fnwn1if8opjpqpbmn.htm"&gt;Base SAS(R) 9.3 Procedures Guide, Second Edition&lt;/A&gt; (proc format).&amp;nbsp; You could use MLF (Multi Labe Format) own proceduers (FCMP)&lt;/P&gt;&lt;P&gt;The switch in thinking: No need to adjust data generate additonal datasets, just apply different formats at analyzing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note:&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#p0bqogcics9o4xn17yvt2qjbgdpi.htm" title="http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#p0bqogcics9o4xn17yvt2qjbgdpi.htm"&gt;Base SAS(R) 9.3 Procedures Guide, Second Edition&lt;/A&gt; (Proc report) This procedure has a compute block (it is exceptional)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 11 Aug 2013 06:36:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/IF-THEN-command/m-p/99275#M9639</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2013-08-11T06:36:48Z</dc:date>
    </item>
  </channel>
</rss>

