<?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 else if statement not working in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/If-then-else-if-statement-not-working/m-p/531432#M145443</link>
    <description>&lt;P&gt;Doesn't work is awful vague.&lt;BR /&gt;&lt;BR /&gt;Are there errors in the log?: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.&lt;BR /&gt;&lt;BR /&gt;No output? Post any log in a code box.&lt;BR /&gt;&lt;BR /&gt;Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat&lt;/A&gt;... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Jan 2019 16:53:52 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-01-30T16:53:52Z</dc:date>
    <item>
      <title>If then else if statement not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-else-if-statement-not-working/m-p/531418#M145436</link>
      <description>&lt;P&gt;I am using sas studio in the SAS OnDemand for academics,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I imported cvs file to sas table&lt;/P&gt;&lt;P&gt;I want to produce 2 new tables for men and woman, but when I use the following code I get no observations in the mens output table and the original data set in the females output table&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code I used:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* Código generado (IMPORT) */&lt;BR /&gt;/* Archivo de origen: tsdem.csv */&lt;BR /&gt;/* Ruta de origen: /home/tessygsv0/ECOPRED CSV */&lt;BR /&gt;/* Código generado el: 29/1/19 15:17 */&lt;/P&gt;&lt;P&gt;%web_drop_table(WORK.TSDEM);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;FILENAME REFFILE '/home/tessygsv0/ECOPRED CSV/tsdem.csv';&lt;/P&gt;&lt;P&gt;PROC IMPORT DATAFILE=REFFILE&lt;BR /&gt;DBMS=CSV&lt;BR /&gt;OUT=WORK.TSDEM;&lt;BR /&gt;GETNAMES=YES;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;PROC CONTENTS DATA=WORK.TSDEM; RUN;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%web_open_table(WORK.TSDEM);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This the code which is not working:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data hombres mujeres;&lt;BR /&gt;set work.TSDEM;&lt;BR /&gt;if SEXO='1' then output hombres;&lt;BR /&gt;else output mujeres;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 16:01:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-else-if-statement-not-working/m-p/531418#M145436</guid>
      <dc:creator>Tessy</dc:creator>
      <dc:date>2019-01-30T16:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: If then else if statement not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-else-if-statement-not-working/m-p/531421#M145437</link>
      <description>&lt;P&gt;Hi Tessy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your if-then-else-construct writes to the mujeres-dataset, if variable SEXO is empty or anything but '1' . Are you sure that your import works as expected, so you actually get value '1' for hombres? - Try making a Proc print and see what you get.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 16:11:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-else-if-statement-not-working/m-p/531421#M145437</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2019-01-30T16:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: If then else if statement not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-else-if-statement-not-working/m-p/531427#M145439</link>
      <description>&lt;P&gt;In general you rarely need to split your data set, instead use By statements. See the sample below. If you want to get your code working, please post the log from your code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=tsdem;
by sexo;
run;

proc freq data=tsdem;
table sexo;
run;

proc print data=tsdem;
by sexo;
run;


proc means data=TSDEM;
by sexo;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/211588"&gt;@Tessy&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am using sas studio in the SAS OnDemand for academics,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I imported cvs file to sas table&lt;/P&gt;
&lt;P&gt;I want to produce 2 new tables for men and woman, but when I use the following code I get no observations in the mens output table and the original data set in the females output table&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the code I used:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/* Código generado (IMPORT) */&lt;BR /&gt;/* Archivo de origen: tsdem.csv */&lt;BR /&gt;/* Ruta de origen: /home/tessygsv0/ECOPRED CSV */&lt;BR /&gt;/* Código generado el: 29/1/19 15:17 */&lt;/P&gt;
&lt;P&gt;%web_drop_table(WORK.TSDEM);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;FILENAME REFFILE '/home/tessygsv0/ECOPRED CSV/tsdem.csv';&lt;/P&gt;
&lt;P&gt;PROC IMPORT DATAFILE=REFFILE&lt;BR /&gt;DBMS=CSV&lt;BR /&gt;OUT=WORK.TSDEM;&lt;BR /&gt;GETNAMES=YES;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;PROC CONTENTS DATA=WORK.TSDEM; RUN;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%web_open_table(WORK.TSDEM);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This the code which is not working:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data hombres mujeres;&lt;BR /&gt;set work.TSDEM;&lt;BR /&gt;if SEXO='1' then output hombres;&lt;BR /&gt;else output mujeres;&lt;BR /&gt;run;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 16:24:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-else-if-statement-not-working/m-p/531427#M145439</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-30T16:24:20Z</dc:date>
    </item>
    <item>
      <title>Re: If then else if statement not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-else-if-statement-not-working/m-p/531432#M145443</link>
      <description>&lt;P&gt;Doesn't work is awful vague.&lt;BR /&gt;&lt;BR /&gt;Are there errors in the log?: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.&lt;BR /&gt;&lt;BR /&gt;No output? Post any log in a code box.&lt;BR /&gt;&lt;BR /&gt;Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat&lt;/A&gt;... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 16:53:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-else-if-statement-not-working/m-p/531432#M145443</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-01-30T16:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: If then else if statement not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-else-if-statement-not-working/m-p/531440#M145445</link>
      <description>Thank you for your help.&lt;BR /&gt;&lt;BR /&gt;I did the procprint procedure, I didn't get any value as result, but I got&lt;BR /&gt;this LOG&lt;BR /&gt;&lt;BR /&gt;CODE:&lt;BR /&gt;&lt;BR /&gt;proc print data=WORK.tsdem;&lt;BR /&gt;%let obsKeep = 10;&lt;BR /&gt;var LLAVE_J SEXO EDAD;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;BR /&gt;4 OPTIONS LOCALE=es_419 DFLANG=LOCALE;&lt;BR /&gt;______&lt;BR /&gt;14&lt;BR /&gt;ERROR 14-12: Invalid option value ES_419 for SAS option LOCALE.&lt;BR /&gt;70&lt;BR /&gt;71 proc print data=WORK.tsdem;&lt;BR /&gt;72 %let obsKeep = 10;&lt;BR /&gt;73 var LLAVE_J SEXO EDAD;&lt;BR /&gt;74 run;&lt;BR /&gt;NOTE: There were 309863 observations read from the data set WORK.TSDEM.&lt;BR /&gt;NOTE: PROCEDIMIENTO PRINT used (Total process time):&lt;BR /&gt;real time 17.12 seconds&lt;BR /&gt;user cpu time 17.10 seconds&lt;BR /&gt;system cpu time 0.03 seconds&lt;BR /&gt;memory 4167.62k&lt;BR /&gt;OS Memory 35760.00k&lt;BR /&gt;Timestamp 30/01/2019 05:14:35 p.m.&lt;BR /&gt;Step Count 112 Switch Count 1&lt;BR /&gt;Page Faults 0&lt;BR /&gt;Page Reclaims 413&lt;BR /&gt;Page Swaps 0&lt;BR /&gt;Voluntary Context Switches 11&lt;BR /&gt;Involuntary Context Switches 21&lt;BR /&gt;Block Input Operations 0&lt;BR /&gt;Block Output Operations 8720&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 30 Jan 2019 17:18:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-else-if-statement-not-working/m-p/531440#M145445</guid>
      <dc:creator>Tessy</dc:creator>
      <dc:date>2019-01-30T17:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: If then else if statement not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-else-if-statement-not-working/m-p/531443#M145447</link>
      <description>&lt;P&gt;That error has nothing to do with your code.&lt;/P&gt;
&lt;P&gt;SAS is complaining about the setting for the LOCALE option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;4 OPTIONS LOCALE=es_419 DFLANG=LOCALE;
                 ______
                 14
ERROR 14-12: Invalid option value ES_419 for SAS option LOCALE.&lt;/PRE&gt;
&lt;P&gt;Check and see if there is an option or preference setting in SAS/Studio that will let you change that so that SAS/Studio doesn't try to send SAS and invalid value.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 17:24:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-else-if-statement-not-working/m-p/531443#M145447</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-01-30T17:24:25Z</dc:date>
    </item>
  </channel>
</rss>

