<?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: Dummy Variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Dummy-Variable/m-p/466092#M118907</link>
    <description>&lt;P&gt;The harder part is setting to 0, adding the column is relatively trivial. Make a table with the structure you want and append it to that with 0 obs from the master table.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can have missing in you data this makes this a bit more complex, but if you don't, you can set any missing to 0 and be done.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
   create table table_format 
       (ID char(8),
        Col1 num,
        Col2 num,
        Col3 num,
        Col4 num,
        Col5 num);
quit;

proc sql;
   create table myData
       (ID char(8),
        Col1 num,
        Col2 num,
        Col3 num,
        Col5 num);
   insert into myData
   values ('1', 1, 0, 0, 1)
   values ('2', 1, 0, 1, 0);
quit;


data want;
set table_format(Obs=0) myData;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 30 May 2018 15:28:14 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-05-30T15:28:14Z</dc:date>
    <item>
      <title>Dummy Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dummy-Variable/m-p/466063#M118890</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 5 columns with values as 0 or 1.&lt;/P&gt;&lt;P&gt;Id Col1 Col2 Col3 Col4 Col5&lt;BR /&gt;1&amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; 0&amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;&lt;P&gt;4&amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;&lt;P&gt;5&amp;nbsp; &amp;nbsp; 0&amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;I am running a big program every week,the issue is for some week, one of the column have no data, hence that particular column itself is missing. For my report, I need that column,&amp;nbsp; so&amp;nbsp; would like to add a dummy column( missing column lets say col5) and assign values as 0. I tried Proc sql with case statement at the end of the final dataset which is not working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for checking.&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 14:48:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dummy-Variable/m-p/466063#M118890</guid>
      <dc:creator>Kalai2008</dc:creator>
      <dc:date>2018-05-30T14:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: Dummy Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dummy-Variable/m-p/466068#M118895</link>
      <description>&lt;P&gt;Better would be to show an example of the input file with your problem and then what the desired output for that file would look like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For instance, I am not sure when you say "&amp;nbsp;one of the column have no data" whether that means the value of a variable is missing for all rows or data or only for a few.&lt;/P&gt;
&lt;P&gt;What do you want if two variables are showing this behavior? or three?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 14:54:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dummy-Variable/m-p/466068#M118895</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-05-30T14:54:29Z</dc:date>
    </item>
    <item>
      <title>Re: Dummy Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dummy-Variable/m-p/466076#M118900</link>
      <description>&lt;P&gt;Thanks ! You are right. This behavior can happen to 2 or more variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I meant no data means, the value of the variable is missing for all rows&amp;nbsp; from the prior step. I can't able to show the data in detail.&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 15:08:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dummy-Variable/m-p/466076#M118900</guid>
      <dc:creator>Kalai2008</dc:creator>
      <dc:date>2018-05-30T15:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: Dummy Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dummy-Variable/m-p/466092#M118907</link>
      <description>&lt;P&gt;The harder part is setting to 0, adding the column is relatively trivial. Make a table with the structure you want and append it to that with 0 obs from the master table.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can have missing in you data this makes this a bit more complex, but if you don't, you can set any missing to 0 and be done.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
   create table table_format 
       (ID char(8),
        Col1 num,
        Col2 num,
        Col3 num,
        Col4 num,
        Col5 num);
quit;

proc sql;
   create table myData
       (ID char(8),
        Col1 num,
        Col2 num,
        Col3 num,
        Col5 num);
   insert into myData
   values ('1', 1, 0, 0, 1)
   values ('2', 1, 0, 1, 0);
quit;


data want;
set table_format(Obs=0) myData;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 May 2018 15:28:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dummy-Variable/m-p/466092#M118907</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-05-30T15:28:14Z</dc:date>
    </item>
    <item>
      <title>Re: Dummy Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dummy-Variable/m-p/466122#M118914</link>
      <description>&lt;P&gt;Thank you.. It worked. Setting up 0 was easy for me.&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 16:49:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dummy-Variable/m-p/466122#M118914</guid>
      <dc:creator>Kalai2008</dc:creator>
      <dc:date>2018-05-30T16:49:41Z</dc:date>
    </item>
  </channel>
</rss>

