<?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: creating dummy variables and assigning flags in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352511#M64014</link>
    <description>&lt;P&gt;Thank you! But there are so many errors in flag creation.&lt;/P&gt;&lt;P&gt;My date columns have null values ie missing values in the table..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.When I use this command with proc sql,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;intck('day', dt_discharge,dt_death) le 30 as flg_30d ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when dt_death has missing values it should give 0 as output but it is returning 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Also, flg_30d or flg_rf&amp;nbsp; as flg_x_30d cannot be used as such in proc sql right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suppose I should use the entire expressions intck('day', dt_discharge,dt_death) le 30 or &lt;SPAN class="token function"&gt;intck&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;('&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;day'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; date_of_discharge&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; death_date&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&amp;nbsp;le &lt;SPAN class="token number"&gt;60 as flg_60d as flg_x_30d&amp;nbsp;&amp;nbsp; in proc sql to flag those variables.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token number"&gt;3. There is another expression in intck('day', dt_discharge,dt_admission) where I have to find the difference between discharge date and&amp;nbsp;second successive&amp;nbsp;admission date&amp;nbsp;to hospital. So how would I&amp;nbsp;find second&amp;nbsp;instance of &amp;nbsp;dt_admission ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token number"&gt;kindly help....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 22 Apr 2017 22:35:55 GMT</pubDate>
    <dc:creator>swar</dc:creator>
    <dc:date>2017-04-22T22:35:55Z</dc:date>
    <item>
      <title>creating dummy variables and assigning flags</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/351987#M63957</link>
      <description>&lt;P&gt;Hi. I have to create&amp;nbsp;five dummy variables&amp;nbsp;by combining&amp;nbsp;2&amp;nbsp;existing tables&amp;nbsp;and assign flags 1 and 0 based on the following conditions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Column&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Set to 1 if and only if:&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;flg_If&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Diagnosed by Infection&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;flg_rf&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Diagnosed by respiratory infection&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;flg_30d&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Patient died within 30 days of discharge&lt;STRONG&gt;(I have dates in another table admission_dt and discharge_dt)&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;flg_60d&lt;/TD&gt;&lt;TD&gt;Patient died in 60 days&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;flg_x_30d&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Either flg_30d or flg_rf are set to 1&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help... How to create new columns and assign flags at the same time?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 02:53:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/351987#M63957</guid>
      <dc:creator>swar</dc:creator>
      <dc:date>2017-04-21T02:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: creating dummy variables and assigning flags</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/351989#M63958</link>
      <description>&lt;P&gt;Please provide meaningful examples of the two tables.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 02:59:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/351989#M63958</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-04-21T02:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: creating dummy variables and assigning flags</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/351997#M63959</link>
      <description>&lt;P&gt;The tables are as follows&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;patientid&amp;nbsp;&amp;nbsp; &amp;nbsp;claim_id&amp;nbsp; &amp;nbsp;date_of_admission&amp;nbsp;&amp;nbsp; date_of_discharge&amp;nbsp; death_date&amp;nbsp;&amp;nbsp; code&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 1&amp;nbsp; 12/1/2011 1/2/2012 1/31/2012&amp;nbsp; P2&lt;/P&gt;&lt;P&gt;2&amp;nbsp; 2&amp;nbsp; 12/1/2010&amp;nbsp; 2/2/2012&amp;nbsp; 2/4/2012&amp;nbsp; R3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second table&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code&amp;nbsp;Description&lt;/P&gt;&lt;P&gt;P2&amp;nbsp; Infection&lt;/P&gt;&lt;P&gt;R3&amp;nbsp; Respiratory infection&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I should create a combined table containing the following columns&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;patient_id claim_id and the below&amp;nbsp;five dummy variables&amp;nbsp;by combining&amp;nbsp;2&amp;nbsp;existing tables&amp;nbsp;and assign flags 1 and 0 based on the following conditions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Column&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Set to 1 if and only if:&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;flg_If&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Diagnosed by Infection&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;flg_rf&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Diagnosed by respiratory infection&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;flg_30d&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Patient died within 30 days of discharge&lt;STRONG&gt;(I have dates in another table admission_dt and discharge_dt)&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;flg_60d&lt;/TD&gt;&lt;TD&gt;Patient died in 60 days&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;flg_x_30d&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Either flg_30d or flg_rf are set to 1&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 21 Apr 2017 03:19:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/351997#M63959</guid>
      <dc:creator>swar</dc:creator>
      <dc:date>2017-04-21T03:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: creating dummy variables and assigning flags</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352011#M63967</link>
      <description>&lt;P&gt;Your sample data should include at minimum 1 of each case of flag, bonus if you have all 2 way, 3 way and 4 way flags and cases where no flags are set.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will allow you to test your logic thoroughly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 03:50:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352011#M63967</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-21T03:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: creating dummy variables and assigning flags</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352121#M63977</link>
      <description>&lt;P&gt;I have given a sample table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, how do I create those 5 new columns as assign flag variables to them using proc sql?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 11:26:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352121#M63977</guid>
      <dc:creator>swar</dc:creator>
      <dc:date>2017-04-21T11:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: creating dummy variables and assigning flags</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352346#M63998</link>
      <description>&lt;P&gt;Something like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input patientid claim_id   
    (date_of_admission   date_of_discharge  death_date) (:mmddyy10.) code $;
format date_of_admission   date_of_discharge  death_date yymmdd10.;
datalines;
1  1  12/1/2011 1/2/2012 1/31/2012  P2
2  2  12/1/2010  2/2/2012  2/4/2012  R3
;

data want;
set have;
flg_rf = code in ("R3");
flg_lf = code in ("P2", "R3");
flg_30d = intck("day", date_of_discharge, death_date) &amp;lt;= 30;
flg_60d = intck("day", date_of_discharge, death_date) &amp;lt;= 60;
flg_x_30d = flg_30d or flg_rf;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Apr 2017 22:06:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352346#M63998</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-04-21T22:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: creating dummy variables and assigning flags</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352353#M63999</link>
      <description>Thanks. But How to set 0 and 1 values to these?</description>
      <pubDate>Fri, 21 Apr 2017 22:52:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352353#M63999</guid>
      <dc:creator>swar</dc:creator>
      <dc:date>2017-04-21T22:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: creating dummy variables and assigning flags</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352365#M64000</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/140213"&gt;@swar&lt;/a&gt; wrote:&lt;BR /&gt;Thanks. But How to set 0 and 1 values to these?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Run the code and check the output.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Apr 2017 01:53:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352365#M64000</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-22T01:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: creating dummy variables and assigning flags</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352368#M64001</link>
      <description>&lt;P&gt;SAS sets the value to 0 for FALSE and 1 for TRUE. So&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;flg_rf = code in ("R3");&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;will assign the value 1 to &lt;EM&gt;flg_rf&lt;/EM&gt; if &lt;EM&gt;code&lt;/EM&gt; is "R3" and 0 otherwise.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Apr 2017 02:09:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352368#M64001</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-04-22T02:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: creating dummy variables and assigning flags</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352477#M64009</link>
      <description>&lt;P&gt;I have another doubt.. Can I write flag variables using proc sql code? If yes how?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot for being patient.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Apr 2017 19:33:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352477#M64009</guid>
      <dc:creator>swar</dc:creator>
      <dc:date>2017-04-22T19:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: creating dummy variables and assigning flags</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352484#M64010</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/140213"&gt;@swar&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I have another doubt.. Can I write flag variables using proc sql code? If yes how?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks a lot for being patient.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That's not a doubt, it's a question.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes you can, the exact same way in fact but using the appropriate SQL statements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select *, sex='F' as indicator_sex
from sashelp.class;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 22 Apr 2017 20:22:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352484#M64010</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-22T20:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: creating dummy variables and assigning flags</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352496#M64011</link>
      <description>&lt;P&gt;&lt;SPAN class="token procnames"&gt;This code is not working. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token procnames"&gt;&lt;SPAN class="token punctuation"&gt;I have used it like this &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;create&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;table&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Table3 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;as&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; *, condition= &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'R3'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; flg_rf&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; table2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; * &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Table3;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token procnames"&gt;I have to create 5 dummy variables.. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token punctuation"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Apr 2017 21:00:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352496#M64011</guid>
      <dc:creator>swar</dc:creator>
      <dc:date>2017-04-22T21:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: creating dummy variables and assigning flags</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352501#M64013</link>
      <description>&lt;P&gt;Check the Log window where SAS tells you why it "is not working".&lt;/P&gt;</description>
      <pubDate>Sat, 22 Apr 2017 21:31:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352501#M64013</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-04-22T21:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: creating dummy variables and assigning flags</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352511#M64014</link>
      <description>&lt;P&gt;Thank you! But there are so many errors in flag creation.&lt;/P&gt;&lt;P&gt;My date columns have null values ie missing values in the table..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.When I use this command with proc sql,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;intck('day', dt_discharge,dt_death) le 30 as flg_30d ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when dt_death has missing values it should give 0 as output but it is returning 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Also, flg_30d or flg_rf&amp;nbsp; as flg_x_30d cannot be used as such in proc sql right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suppose I should use the entire expressions intck('day', dt_discharge,dt_death) le 30 or &lt;SPAN class="token function"&gt;intck&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;('&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;day'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; date_of_discharge&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; death_date&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&amp;nbsp;le &lt;SPAN class="token number"&gt;60 as flg_60d as flg_x_30d&amp;nbsp;&amp;nbsp; in proc sql to flag those variables.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token number"&gt;3. There is another expression in intck('day', dt_discharge,dt_admission) where I have to find the difference between discharge date and&amp;nbsp;second successive&amp;nbsp;admission date&amp;nbsp;to hospital. So how would I&amp;nbsp;find second&amp;nbsp;instance of &amp;nbsp;dt_admission ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token number"&gt;kindly help....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Apr 2017 22:35:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352511#M64014</guid>
      <dc:creator>swar</dc:creator>
      <dc:date>2017-04-22T22:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: creating dummy variables and assigning flags</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352525#M64015</link>
      <description>&lt;P&gt;1) Replace the missing death date with a much later date&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;intck('day', dt_discharge,coalesce(dt_death,"31dec2100"d)) le 30 as flg_30d ,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2) Refer to previously calculated values with the keyword &lt;EM&gt;calculated&lt;/EM&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;calculated flg_30d or calculated flg_rf&amp;nbsp; as flg_x_30d&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;3) More detail needed. Where is that re-admission date in your data? I suggest that you post as a new question.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Apr 2017 00:57:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-dummy-variables-and-assigning-flags/m-p/352525#M64015</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-04-23T00:57:39Z</dc:date>
    </item>
  </channel>
</rss>

