<?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: how to keep program line in a order in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-keep-program-line-in-a-order/m-p/499391#M132884</link>
    <description>&lt;P&gt;You should also be able to highlight rows and then press the tab key to see rows indented.&amp;nbsp; Note, good idea to set the tab key up to insert spaces rather than tabs as tabs render differently on different editors.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, some other tips - avoid using all uppercase, its shouting.&amp;nbsp; Use a code window - its the {i} above post area for code, this retains formatting and highlights code for easy viewing as;&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
run;&lt;/PRE&gt;
&lt;P&gt;Use cat() functions rather than lists separated by || as its easy to read (its more important that code be documented and readable at the end of the day).&amp;nbsp; Don't split code over lines unlessyou really have to.&lt;/P&gt;
&lt;P&gt;So to change your code.&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table at as
  select cat('label ',strip(f1),' ','=',quote(strip(f3))) as new,
         case when upcase(f4)='STRING' then &lt;BR /&gt;                cat(strip(f1),' ',"=",quote(strip(f3)),' length=$',strip(f5),'.') end as new1,
         case when calculated new1=' ' then new end as new2
  from s1;
quit;;&lt;/PRE&gt;</description>
    <pubDate>Thu, 27 Sep 2018 07:56:39 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-09-27T07:56:39Z</dc:date>
    <item>
      <title>how to keep program line in a order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-keep-program-line-in-a-order/m-p/499367#M132873</link>
      <description>&lt;P&gt;PROC SQL ;&lt;BR /&gt;CREATE TABLE AT AS&lt;BR /&gt;SELECT 'LABEL'||' '||STRIP(F1)||' '||"='"||STRIP(F3)||"'" AS NEW,&lt;BR /&gt;CASE WHEN UPCASE(F4)='STRING' THEN&lt;BR /&gt;STRIP(F1)||' '||"='"||STRIP(F3)||"'"||' LENGTH=$'||STRIP(F5)||'.' END&lt;BR /&gt;AS NEW1,&lt;BR /&gt;case WHEN CALCULATED NEW1=' ' THEN NEW END AS NEW2&lt;BR /&gt;FROM S1 ;&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how to keep program lines in a order like see below ANY SHORT CUT KEY OR PROCEUDURE&lt;/P&gt;&lt;P&gt;PROC SQL ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CREATE TABLE AT AS&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SELECT 'LABEL'||' '||STRIP(F1)||' '||"='"||STRIP(F3)||"'" AS NEW,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CASE WHEN UPCASE(F4)='STRING' THEN&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; STRIP(F1)||' '||"='"||STRIP(F3)||"'"||' LENGTH=$'||STRIP(F5)||'.' END AS NEW1,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case WHEN CALCULATED NEW1=' ' THEN NEW END AS NEW2&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FROM S1 ;&lt;BR /&gt;QUIT;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Sep 2018 04:45:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-keep-program-line-in-a-order/m-p/499367#M132873</guid>
      <dc:creator>thanikondharish</dc:creator>
      <dc:date>2018-09-27T04:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to keep program line in a order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-keep-program-line-in-a-order/m-p/499372#M132877</link>
      <description>&lt;P&gt;Use Ctrl-i&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that all-uppercase programming is a thing of the computing stoneage and makes code less readable to eyes used to reading.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Sep 2018 06:07:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-keep-program-line-in-a-order/m-p/499372#M132877</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-09-27T06:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: how to keep program line in a order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-keep-program-line-in-a-order/m-p/499373#M132878</link>
      <description>&lt;P&gt;See&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4"&gt;@ChrisHemedinger&lt;/a&gt;s blog post &lt;A href="https://blogs.sas.com/content/sasdummy/2010/07/14/hope-for-ugly-programs/" target="_self"&gt;Hope For Ugly Programs&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use SAS Enterprise Guide and use CTRL+i to indent your code properly. You can go to &lt;STRONG&gt;Program --&amp;gt; Editor Options&lt;/STRONG&gt; and select the &lt;STRONG&gt;Indenter tap&lt;/STRONG&gt; to customize how you want the indentation done.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 337px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23589iD2384CCDBCBC6366/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Sep 2018 06:12:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-keep-program-line-in-a-order/m-p/499373#M132878</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-09-27T06:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: how to keep program line in a order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-keep-program-line-in-a-order/m-p/499383#M132880</link>
      <description>No it didn't work&lt;BR /&gt;when i presss ctrl+i it shows sas system options like see photo&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Sep 2018 07:00:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-keep-program-line-in-a-order/m-p/499383#M132880</guid>
      <dc:creator>thanikondharish</dc:creator>
      <dc:date>2018-09-27T07:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: how to keep program line in a order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-keep-program-line-in-a-order/m-p/499385#M132881</link>
      <description>&lt;P&gt;You have to be in an active Enhanced Editor Window (tested with EG 7.15).&lt;/P&gt;
&lt;P&gt;In SAS Studio, use this icon:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="code_format_icon.jpg"&gt;&lt;img src="https://communities.sas.com/skins/images/E0BB18E7DAA53C21BC28740CEA0E38DA/responsive_peak/images/image_not_found.png" alt="code_format_icon.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Sep 2018 07:19:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-keep-program-line-in-a-order/m-p/499385#M132881</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-09-27T07:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to keep program line in a order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-keep-program-line-in-a-order/m-p/499391#M132884</link>
      <description>&lt;P&gt;You should also be able to highlight rows and then press the tab key to see rows indented.&amp;nbsp; Note, good idea to set the tab key up to insert spaces rather than tabs as tabs render differently on different editors.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, some other tips - avoid using all uppercase, its shouting.&amp;nbsp; Use a code window - its the {i} above post area for code, this retains formatting and highlights code for easy viewing as;&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
run;&lt;/PRE&gt;
&lt;P&gt;Use cat() functions rather than lists separated by || as its easy to read (its more important that code be documented and readable at the end of the day).&amp;nbsp; Don't split code over lines unlessyou really have to.&lt;/P&gt;
&lt;P&gt;So to change your code.&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table at as
  select cat('label ',strip(f1),' ','=',quote(strip(f3))) as new,
         case when upcase(f4)='STRING' then &lt;BR /&gt;                cat(strip(f1),' ',"=",quote(strip(f3)),' length=$',strip(f5),'.') end as new1,
         case when calculated new1=' ' then new end as new2
  from s1;
quit;;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Sep 2018 07:56:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-keep-program-line-in-a-order/m-p/499391#M132884</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-09-27T07:56:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to keep program line in a order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-keep-program-line-in-a-order/m-p/499551#M132955</link>
      <description>&lt;P&gt;FWIW you might be able to make your code easier to read and follow by using the CAT functions&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead of&lt;/P&gt;
&lt;PRE&gt;'LABEL'||' '||STRIP(F1)||' '||"='"||STRIP(F3)||"'" AS NEW,&lt;/PRE&gt;
&lt;P&gt;try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;catx(' ','Label', strip(f1),'=', quote(strip(f3)) ) as new&lt;/PRE&gt;
&lt;P&gt;And if the purpose of strip(f1) is to remove possible trailing blanks then the STRIP() is not needed as CATX removes trailing blanks when&amp;nbsp;concatenating values. The&amp;nbsp;CATX function first parameter is a delimiter to separate the other character elements, so the above inserts a space between each bit which is a whole lot nicer than a lot of ||' '|| constructs when it comes to reading the code. The delimiter can be any string literal value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;The QUOTE function will also place quotes around text in a way that is somewhat easier to understand than&amp;nbsp; "'"||STRIP(F3)||"'" though it does want the STRIP to avoid having trailing blanks inside the applied quotes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The more elements you are placing in a string the easier using CATX becomes compared to multiple || operators.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Sep 2018 15:22:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-keep-program-line-in-a-order/m-p/499551#M132955</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-09-27T15:22:31Z</dc:date>
    </item>
  </channel>
</rss>

