<?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 how to use case statements efficiently in the shortest way(one line preferred) possible in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-use-case-statements-efficiently-in-the-shortest-way-one/m-p/757518#M239125</link>
    <description>&lt;P&gt;Hello everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking for a condensed way to write the following (repetitive and hard coded) block of code. Is there a way to do so in macro or something else? Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;case when gender = 'M'&amp;nbsp; then A &amp;nbsp;else ' ' end) as MA,&lt;/P&gt;&lt;P&gt;case when gender = 'M’&amp;nbsp; then B else . end) as MB,&lt;/P&gt;&lt;P&gt;&amp;nbsp;case when gender = 'M'&amp;nbsp; then C else . end) as MC,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;case when gender = 'F'&amp;nbsp; then A else ' ' end) as FA,&lt;/P&gt;&lt;P&gt;case when gender = 'F'&amp;nbsp; then B else . end) as FB,&lt;/P&gt;&lt;P&gt;case when gender = 'F'&amp;nbsp; then C else . end) as FC&lt;/P&gt;&lt;P&gt;(and so on...)&lt;/P&gt;&lt;P&gt;FROM student;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Jul 2021 20:31:06 GMT</pubDate>
    <dc:creator>inquistive</dc:creator>
    <dc:date>2021-07-27T20:31:06Z</dc:date>
    <item>
      <title>how to use case statements efficiently in the shortest way(one line preferred) possible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-use-case-statements-efficiently-in-the-shortest-way-one/m-p/757518#M239125</link>
      <description>&lt;P&gt;Hello everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking for a condensed way to write the following (repetitive and hard coded) block of code. Is there a way to do so in macro or something else? Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;case when gender = 'M'&amp;nbsp; then A &amp;nbsp;else ' ' end) as MA,&lt;/P&gt;&lt;P&gt;case when gender = 'M’&amp;nbsp; then B else . end) as MB,&lt;/P&gt;&lt;P&gt;&amp;nbsp;case when gender = 'M'&amp;nbsp; then C else . end) as MC,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;case when gender = 'F'&amp;nbsp; then A else ' ' end) as FA,&lt;/P&gt;&lt;P&gt;case when gender = 'F'&amp;nbsp; then B else . end) as FB,&lt;/P&gt;&lt;P&gt;case when gender = 'F'&amp;nbsp; then C else . end) as FC&lt;/P&gt;&lt;P&gt;(and so on...)&lt;/P&gt;&lt;P&gt;FROM student;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 20:31:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-use-case-statements-efficiently-in-the-shortest-way-one/m-p/757518#M239125</guid>
      <dc:creator>inquistive</dc:creator>
      <dc:date>2021-07-27T20:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to use case statements efficiently in the shortest way(one line preferred) possible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-use-case-statements-efficiently-in-the-shortest-way-one/m-p/757519#M239126</link>
      <description>&lt;P&gt;A data step is probably more efficient for starters. Can you explain a bit more about what you're trying to do here overall?&lt;BR /&gt;Not sure a one liner is possible if you're creating multiple variables. This looks possibly like a transpose though, which may be better in PROC TRANSPOSE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/83652"&gt;@inquistive&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello everyone,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am looking for a condensed way to write the following (repetitive and hard coded) block of code. Is there a way to do so in macro or something else? Any help would be greatly appreciated.&lt;/P&gt;
&lt;P&gt;case when gender = 'M'&amp;nbsp; then A &amp;nbsp;else ' ' end) as MA,&lt;/P&gt;
&lt;P&gt;case when gender = 'M’&amp;nbsp; then B else . end) as MB,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;case when gender = 'M'&amp;nbsp; then C else . end) as MC,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;case when gender = 'F'&amp;nbsp; then A else ' ' end) as FA,&lt;/P&gt;
&lt;P&gt;case when gender = 'F'&amp;nbsp; then B else . end) as FB,&lt;/P&gt;
&lt;P&gt;case when gender = 'F'&amp;nbsp; then C else . end) as FC&lt;/P&gt;
&lt;P&gt;(and so on...)&lt;/P&gt;
&lt;P&gt;FROM student;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 20:40:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-use-case-statements-efficiently-in-the-shortest-way-one/m-p/757519#M239126</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-27T20:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: how to use case statements efficiently in the shortest way(one line preferred) possible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-use-case-statements-efficiently-in-the-shortest-way-one/m-p/757524#M239128</link>
      <description>&lt;P&gt;This is just a part of a larger query. In this part I am trying to grouping the data for easier analysis.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 20:46:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-use-case-statements-efficiently-in-the-shortest-way-one/m-p/757524#M239128</guid>
      <dc:creator>inquistive</dc:creator>
      <dc:date>2021-07-27T20:46:29Z</dc:date>
    </item>
    <item>
      <title>Re: how to use case statements efficiently in the shortest way(one line preferred) possible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-use-case-statements-efficiently-in-the-shortest-way-one/m-p/757525#M239129</link>
      <description>&lt;P&gt;Then I suspect the answer is no, based on what you've shown so far. I strongly suspect there's other ways to get what you need but SQL isn't particularly great at wrangling data efficiently across many variables sometimes.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 20:54:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-use-case-statements-efficiently-in-the-shortest-way-one/m-p/757525#M239129</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-27T20:54:40Z</dc:date>
    </item>
  </channel>
</rss>

