<?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: documentation on how to write 'brief' codes in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/documentation-on-how-to-write-brief-codes/m-p/948750#M371180</link>
    <description>&lt;P&gt;This is a great question, as SAS (and other programming languages) have idioms that users adopt and that are difficult to find as reference in the documentation. You see them in examples of other people's work, and many have been described in SAS conference papers or other articles.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In practice, most programmers use a construct like:&lt;/P&gt;
&lt;PRE&gt;x+1;&lt;/PRE&gt;
&lt;P&gt;To mean x=x+1, and this is executed at every iteration of the DATA step loop. I recommend using the DATA step debugger (available in SAS Enterprise Guide or SAS Studio on Viya) to step through and see exactly what's going on. A common use case is a running total sum, like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
 retain runningtotal_weight 0;
 set sashelp.class;
 runningtotal_weight + weight;
run;
 &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But as others point out, there are other use cases.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 23 Oct 2024 14:27:41 GMT</pubDate>
    <dc:creator>ChrisHemedinger</dc:creator>
    <dc:date>2024-10-23T14:27:41Z</dc:date>
    <item>
      <title>documentation on how to write 'brief' codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/documentation-on-how-to-write-brief-codes/m-p/948728#M371175</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a silly question to ask. Is there any document that I can use to better understand the sas codes that are written in very brief way? (to be honest, I don't know the exact terms to describe this situation. Maybe following example can better explain the situation)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
set have;
m1+5;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; It looks like m1+5 in fact is m1=m1+5. I am not sure about that, but the output suggested that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am still new to sas. When I read suggestion from the posts, there are quite some lines that were written in such matter and I don't know for sure which value/variable that they were imply to. Is there any document on this aspect?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2024 13:06:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/documentation-on-how-to-write-brief-codes/m-p/948728#M371175</guid>
      <dc:creator>stataq</dc:creator>
      <dc:date>2024-10-23T13:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: documentation on how to write 'brief' codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/documentation-on-how-to-write-brief-codes/m-p/948735#M371177</link>
      <description>&lt;P&gt;First, m1+5 is not in general the same as m1=m1+5, although in this case it might be.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think your broader question is about documentation, when you come across a PROC or Function or Statement that you don't understand, you should look it up.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Documentation:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/allprodsproc/procedures.htm" target="_self"&gt;Alphabetical list of all SAS PROCs&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmmvacdc/9.4/allprodslang/syntaxByType-function.htm" target="_self"&gt;Alphabetical list of all SAS Functions&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmmvacdc/9.4/allprodslang/syntaxByType-statement.htm" target="_self"&gt;Alphabetical list of all SAS Statements&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2024 13:28:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/documentation-on-how-to-write-brief-codes/m-p/948735#M371177</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-10-23T13:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: documentation on how to write 'brief' codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/documentation-on-how-to-write-brief-codes/m-p/948739#M371178</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/448857"&gt;@stataq&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The case of &lt;FONT face="courier new,courier"&gt;m1+5;&lt;/FONT&gt; is indeed a bit tricky to look up in an &lt;EM&gt;alphabetical&lt;/EM&gt; list of language elements as it is one of the rare examples where the name of the statement is not part of the syntax. It is called &lt;EM&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n1dfiqj146yi2cn1maeju9wo7ijs.htm" target="_blank" rel="noopener"&gt;sum statement&lt;/A&gt;&lt;/EM&gt;, so you find it under the letter "S" in the&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/p0gct6ariiecuhn15jkq8pzfzgef.htm" target="_blank" rel="noopener"&gt;Dictionary of SAS DATA Step Statements&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2024 13:44:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/documentation-on-how-to-write-brief-codes/m-p/948739#M371178</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-10-23T13:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: documentation on how to write 'brief' codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/documentation-on-how-to-write-brief-codes/m-p/948750#M371180</link>
      <description>&lt;P&gt;This is a great question, as SAS (and other programming languages) have idioms that users adopt and that are difficult to find as reference in the documentation. You see them in examples of other people's work, and many have been described in SAS conference papers or other articles.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In practice, most programmers use a construct like:&lt;/P&gt;
&lt;PRE&gt;x+1;&lt;/PRE&gt;
&lt;P&gt;To mean x=x+1, and this is executed at every iteration of the DATA step loop. I recommend using the DATA step debugger (available in SAS Enterprise Guide or SAS Studio on Viya) to step through and see exactly what's going on. A common use case is a running total sum, like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
 retain runningtotal_weight 0;
 set sashelp.class;
 runningtotal_weight + weight;
run;
 &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But as others point out, there are other use cases.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2024 14:27:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/documentation-on-how-to-write-brief-codes/m-p/948750#M371180</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2024-10-23T14:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: documentation on how to write 'brief' codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/documentation-on-how-to-write-brief-codes/m-p/948752#M371182</link>
      <description>&lt;P&gt;The best starting point to learn "brief" codes is to learn more about SAS procedures.&amp;nbsp; These are routines that are already written, already debugged, and well documented.&amp;nbsp; They often replace dozens of lines of code if you were to try to write something from scratch.&lt;/P&gt;
&lt;P&gt;Take some common procedures:&amp;nbsp; FREQ, MEANS, FORMAT, even PRINT.&amp;nbsp; Read about them and play with them until you know more than twice as much as what you know now.&amp;nbsp; Procedures embody expert decisions about what functionality is important, and would be useful to have put into a shortened, easier-to-use form.&lt;/P&gt;
&lt;P&gt;Just my two cents.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2024 14:32:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/documentation-on-how-to-write-brief-codes/m-p/948752#M371182</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2024-10-23T14:32:03Z</dc:date>
    </item>
  </channel>
</rss>

