<?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 with multiple variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Case-statement-with-multiple-variables/m-p/766992#M243091</link>
    <description>&lt;DIV&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Hi ChrisNZ,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Thank you for the help.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;May I just request another thing. Sorry I am really a newbie here.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;The code is working, it's just that I am having trouble for some months with duplicates and are under the same name.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;How can I eliminate those duplicates based on file attachments? *The latest date will be retained.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;The attachment is concatenated with filename, month, day and time.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Something like this:&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;CODE&gt;data HAVE;
 input NAME $ TRANS_MONTH $ FILE_ATTACH $;
 cards;
A 01 QQQFEB2207:54
A 01 QQQFEB2002:54
A 04 DDDMAR0112:01
B 01 DDDJAN1807:00
B 05 YYYSEP0111:10
B 05 GGGOCT1108:21
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;The output should be something like this:&lt;BR /&gt;&lt;/CODE&gt;&lt;CODE&gt;&lt;SPAN class="im"&gt;&lt;SPAN&gt;Obs NAME MTH01         MTH02 MTH03     MTH04     MTH05 MTH06 MTH07 MTH08 MTH09 MTH10 MTH11 MTH12&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;CODE&gt;&lt;SPAN&gt;1    A   QQQFEB2207:54 X      X     DDDMAR0112:01  X    X     X      X     X     X      X     X&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;CODE&gt;&lt;SPAN&gt;2    B   DDDJAN1807:00 X      X        X       GGG1108:21 X    X     X     X     X      X     X&lt;BR /&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;SPAN&gt;Thank you so much and have a great day ahead.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;maricelj&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV class="yj6qo ajU"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
    <pubDate>Fri, 10 Sep 2021 01:25:04 GMT</pubDate>
    <dc:creator>maricelj</dc:creator>
    <dc:date>2021-09-10T01:25:04Z</dc:date>
    <item>
      <title>Case statement with multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Case-statement-with-multiple-variables/m-p/765316#M242406</link>
      <description>Hello, I am a newbie here, I need your help. Thank you in advance.&lt;BR /&gt;&lt;BR /&gt;My data goes like this:&lt;BR /&gt;Data: Test&lt;BR /&gt;Name Trans_Month File_Attach&lt;BR /&gt;A 01 QQQ&lt;BR /&gt;A 02 BBB&lt;BR /&gt;A 04 DDD&lt;BR /&gt;B 01 DDD&lt;BR /&gt;B 02 YYY&lt;BR /&gt;B 05 GGG&lt;BR /&gt;&lt;BR /&gt;This is the Output i am looking for:&lt;BR /&gt;[NOTE: Trans_Month=01 to 12, if no file_attach on a specific trans_month then file_attach=X]&lt;BR /&gt;Name 01 02 03 04 05 ....&lt;BR /&gt;A QQQ BBB X DDD X&lt;BR /&gt;B DDD YYY X X GGG&lt;BR /&gt;&lt;BR /&gt;I used case statement but the output goes like this:&lt;BR /&gt;Name 01 02 03 04 05 .....&lt;BR /&gt;A QQQ&lt;BR /&gt;A ______BBB&lt;BR /&gt;A ___________X&lt;BR /&gt;A____________ DDD&lt;BR /&gt;A _________________X&lt;BR /&gt;B DDD&lt;BR /&gt;B _____YYY&lt;BR /&gt;B ___________X&lt;BR /&gt;B _______________X&lt;BR /&gt;B __________________GGG&lt;BR /&gt;&lt;BR /&gt;(please disregard the line (____), treat it as blank space)&lt;BR /&gt;What shall i do to place the output within the same row? Thank you so much.</description>
      <pubDate>Wed, 01 Sep 2021 12:07:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Case-statement-with-multiple-variables/m-p/765316#M242406</guid>
      <dc:creator>maricelj</dc:creator>
      <dc:date>2021-09-01T12:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: Case statement with multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Case-statement-with-multiple-variables/m-p/766153#M242778</link>
      <description>&lt;P&gt;Something like this should help.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data HAVE;
 input NAME $ TRANS_MONTH $ FILE_ATTACH $;
 cards;
A 01 QQQ
A 02 BBB
A 04 DDD
B 01 DDD
B 02 YYY
B 05 GGG
;
proc transpose data=HAVE out=TRANS prefix=MTH;
  by NAME;  
  id TRANS_MONTH;  
  var FILE_ATTACH;
run;
data WANT;
  array M [12] $8 MTH01 - MTH12 ;
  set TRANS ;
  do I=1 to 12;
    if missing(M[I]) then M[I]='X';
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please adapt to your needs.&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="left"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.WANT" width="559px" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r header" scope="col" width="11px" height="55px"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;Obs&lt;/FONT&gt;&lt;/TH&gt;
&lt;TH class="l header" scope="col" width="40px" height="55px"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;NAME&lt;/FONT&gt;&lt;/TH&gt;
&lt;TH class="l header" scope="col" width="49px" height="55px"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;MTH01&lt;/FONT&gt;&lt;/TH&gt;
&lt;TH class="l header" scope="col" width="44px" height="55px"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;MTH02&lt;/FONT&gt;&lt;/TH&gt;
&lt;TH class="l header" scope="col" width="40px" height="55px"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;MTH03&lt;/FONT&gt;&lt;/TH&gt;
&lt;TH class="l header" scope="col" width="46px" height="55px"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;MTH04&lt;/FONT&gt;&lt;/TH&gt;
&lt;TH class="l header" scope="col" width="49px" height="55px"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;MTH05&lt;/FONT&gt;&lt;/TH&gt;
&lt;TH class="l header" scope="col" width="40px" height="55px"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;MTH06&lt;/FONT&gt;&lt;/TH&gt;
&lt;TH class="l header" scope="col" width="40px" height="55px"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;MTH07&lt;/FONT&gt;&lt;/TH&gt;
&lt;TH class="l header" scope="col" width="40px" height="55px"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;MTH08&lt;/FONT&gt;&lt;/TH&gt;
&lt;TH class="l header" scope="col" width="40px" height="55px"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;MTH09&lt;/FONT&gt;&lt;/TH&gt;
&lt;TH class="l header" scope="col" width="40px" height="55px"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;MTH10&lt;/FONT&gt;&lt;/TH&gt;
&lt;TH class="l header" scope="col" width="40px" height="55px"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;MTH11&lt;/FONT&gt;&lt;/TH&gt;
&lt;TH class="l header" scope="col" width="40px" height="55px"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;MTH12&lt;/FONT&gt;&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row" width="11px" height="30px"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;1&lt;/FONT&gt;&lt;/TH&gt;
&lt;TD width="40px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;A&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="49px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;QQQ&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="44px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;BBB&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="40px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;X&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="46px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;DDD&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="49px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;X&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="40px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;X&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="40px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;X&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="40px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;X&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="40px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;X&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="40px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;X&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="40px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;X&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="40px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;X&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row" width="11px" height="30px"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;2&lt;/FONT&gt;&lt;/TH&gt;
&lt;TD width="40px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;B&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="49px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;DDD&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="44px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;YYY&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="40px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;X&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="46px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;X&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="49px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;GGG&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="40px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;X&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="40px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;X&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="40px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;X&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="40px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;X&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="40px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;X&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="40px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;X&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="40px" height="30px" class="l data"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;X&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 06 Sep 2021 02:16:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Case-statement-with-multiple-variables/m-p/766153#M242778</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-09-06T02:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: Case statement with multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Case-statement-with-multiple-variables/m-p/766295#M242852</link>
      <description>Hi,&lt;BR /&gt;Thank you for this.&lt;BR /&gt;Will try to give you feedback as soon as possible.&lt;BR /&gt;Keep safe and have a great day ahead.&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Sep 2021 01:41:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Case-statement-with-multiple-variables/m-p/766295#M242852</guid>
      <dc:creator>maricelj</dc:creator>
      <dc:date>2021-09-07T01:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: Case statement with multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Case-statement-with-multiple-variables/m-p/766299#M242855</link>
      <description>&lt;P&gt;No worries. Note the code used to create table HAVE. &lt;U&gt;That's how you should provide data.&lt;/U&gt;&amp;nbsp; A table is not useful to recreate your problem.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 01:54:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Case-statement-with-multiple-variables/m-p/766299#M242855</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-09-07T01:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: Case statement with multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Case-statement-with-multiple-variables/m-p/766992#M243091</link>
      <description>&lt;DIV&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Hi ChrisNZ,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Thank you for the help.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;May I just request another thing. Sorry I am really a newbie here.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;The code is working, it's just that I am having trouble for some months with duplicates and are under the same name.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;How can I eliminate those duplicates based on file attachments? *The latest date will be retained.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;The attachment is concatenated with filename, month, day and time.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Something like this:&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;CODE&gt;data HAVE;
 input NAME $ TRANS_MONTH $ FILE_ATTACH $;
 cards;
A 01 QQQFEB2207:54
A 01 QQQFEB2002:54
A 04 DDDMAR0112:01
B 01 DDDJAN1807:00
B 05 YYYSEP0111:10
B 05 GGGOCT1108:21
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;The output should be something like this:&lt;BR /&gt;&lt;/CODE&gt;&lt;CODE&gt;&lt;SPAN class="im"&gt;&lt;SPAN&gt;Obs NAME MTH01         MTH02 MTH03     MTH04     MTH05 MTH06 MTH07 MTH08 MTH09 MTH10 MTH11 MTH12&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;CODE&gt;&lt;SPAN&gt;1    A   QQQFEB2207:54 X      X     DDDMAR0112:01  X    X     X      X     X     X      X     X&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;CODE&gt;&lt;SPAN&gt;2    B   DDDJAN1807:00 X      X        X       GGG1108:21 X    X     X     X     X      X     X&lt;BR /&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;SPAN&gt;Thank you so much and have a great day ahead.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;maricelj&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV class="yj6qo ajU"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Fri, 10 Sep 2021 01:25:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Case-statement-with-multiple-variables/m-p/766992#M243091</guid>
      <dc:creator>maricelj</dc:creator>
      <dc:date>2021-09-10T01:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: Case statement with multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Case-statement-with-multiple-variables/m-p/767004#M243101</link>
      <description>&lt;P&gt;You need to sort the source data by date and keep the last observation.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data HAVE(index=(A=(NAME TRANS_MONTH DATE)));
 input NAME $ TRANS_MONTH $ FILE_ATTACH $;
 DATE=input(substr(FILE_ATTACH,4),monyy5.);
 cards;
A 01 QQQFEB2207:54
A 01 QQQFEB2002:54
A 04 DDDMAR0112:01
B 01 DDDJAN1807:00
B 05 YYYSEP0111:10
B 05 GGGOCT1108:21
;
data FILTERED;
  set HAVE;
  by NAME TRANS_MONTH DATE;
  if last.TRANS_MONTH;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Sep 2021 07:16:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Case-statement-with-multiple-variables/m-p/767004#M243101</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-09-10T07:16:41Z</dc:date>
    </item>
    <item>
      <title>Re: Case statement with multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Case-statement-with-multiple-variables/m-p/767009#M243104</link>
      <description>&lt;P&gt;CrizNZ,&lt;/P&gt;&lt;P&gt;Thank you so much. It works.&lt;/P&gt;&lt;P&gt;Have a great day and keep safe.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Sep 2021 07:49:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Case-statement-with-multiple-variables/m-p/767009#M243104</guid>
      <dc:creator>maricelj</dc:creator>
      <dc:date>2021-09-10T07:49:24Z</dc:date>
    </item>
  </channel>
</rss>

