<?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: Case Statement or something else? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Case-Statement-or-something-else/m-p/484695#M125847</link>
    <description>&lt;P&gt;In a first data step, add a variable x that contains just a 'Y'.&lt;/P&gt;
&lt;P&gt;Then transpose with&lt;/P&gt;
&lt;P&gt;by user;&lt;/P&gt;
&lt;P&gt;id session;&lt;/P&gt;
&lt;P&gt;var x;&lt;/P&gt;
&lt;P&gt;In a final data step, replace all missing character variables with 'N'.&lt;/P&gt;
&lt;P&gt;This method is data-driven , no explicit coding for values is needed.&lt;/P&gt;
&lt;P&gt;Note that for this to work, session must contain valid SAS names.&lt;/P&gt;</description>
    <pubDate>Tue, 07 Aug 2018 11:14:37 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-08-07T11:14:37Z</dc:date>
    <item>
      <title>Case Statement or something else?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Case-Statement-or-something-else/m-p/484693#M125846</link>
      <description>&lt;P&gt;So I have a file that has the following data:&lt;/P&gt;
&lt;P&gt;User,&lt;/P&gt;
&lt;P&gt;Session&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I want to happen is I want to list a user and then for each of the three sessions have a "Y" or "N" if they attended.&amp;nbsp; So something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="302"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;User&lt;/TD&gt;
&lt;TD width="87"&gt;Session 1&lt;/TD&gt;
&lt;TD width="87"&gt;Session 2&lt;/TD&gt;
&lt;TD width="64"&gt;Session 3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Harry Crumb&lt;/TD&gt;
&lt;TD&gt;Y&lt;/TD&gt;
&lt;TD&gt;N&lt;/TD&gt;
&lt;TD&gt;Y&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried this code, however I am getting three separate lines generated.&amp;nbsp; So I am trying to figure out how to put everything on the 1 line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;CASE
when Session in ('Session_1') then ('Y)
else ('N')
end as Session_1,

CASE
when Session in ('Wave_2') then ('Y')
else ('N')
end as WAVE_2,

CASE
when Session in ('Session_3') then ('Y')
else ('N')
end as Session_3&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was trying to search for the answer, but I am not sure what this type of syntax is called.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 11:06:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Case-Statement-or-something-else/m-p/484693#M125846</guid>
      <dc:creator>IgawaKei29</dc:creator>
      <dc:date>2018-08-07T11:06:48Z</dc:date>
    </item>
    <item>
      <title>Re: Case Statement or something else?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Case-Statement-or-something-else/m-p/484695#M125847</link>
      <description>&lt;P&gt;In a first data step, add a variable x that contains just a 'Y'.&lt;/P&gt;
&lt;P&gt;Then transpose with&lt;/P&gt;
&lt;P&gt;by user;&lt;/P&gt;
&lt;P&gt;id session;&lt;/P&gt;
&lt;P&gt;var x;&lt;/P&gt;
&lt;P&gt;In a final data step, replace all missing character variables with 'N'.&lt;/P&gt;
&lt;P&gt;This method is data-driven , no explicit coding for values is needed.&lt;/P&gt;
&lt;P&gt;Note that for this to work, session must contain valid SAS names.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 11:14:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Case-Statement-or-something-else/m-p/484695#M125847</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-08-07T11:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: Case Statement or something else?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Case-Statement-or-something-else/m-p/484704#M125852</link>
      <description>&lt;P&gt;Thank you that was a big help.&amp;nbsp; I have only used PROC Transpose a few times, so I didn't think of using it here.&amp;nbsp; I will be using this again I'm sure!&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 11:45:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Case-Statement-or-something-else/m-p/484704#M125852</guid>
      <dc:creator>IgawaKei29</dc:creator>
      <dc:date>2018-08-07T11:45:40Z</dc:date>
    </item>
  </channel>
</rss>

