<?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: calculation for every value (SUBJECT) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438392#M109299</link>
    <description>&lt;P&gt;Please review what I posted, particularly:&lt;/P&gt;
&lt;PRE&gt;  title "The Subject: #byval1";&lt;/PRE&gt;
&lt;P&gt;This is not&amp;nbsp;&lt;SPAN&gt;#subjid or anything else, but&amp;nbsp;#&amp;nbsp;byval1, indiccating the Value of the First by group variable.&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Feb 2018 13:28:15 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-02-19T13:28:15Z</dc:date>
    <item>
      <title>calculation for every value (SUBJECT)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438350#M109278</link>
      <description>&lt;P&gt;Hi, I need some do loop part for repeating calculation for every values .&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2018 07:47:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438350#M109278</guid>
      <dc:creator>Vahe_Mar</dc:creator>
      <dc:date>2018-02-19T07:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: calculation for every value (SUBJECT)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438351#M109279</link>
      <description>&lt;P&gt;You have to be more specific. Show us your problem, preferably with some sample data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sound like By Group Processing is your answer though.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2018 08:15:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438351#M109279</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-02-19T08:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: calculation for every value (SUBJECT)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438354#M109280</link>
      <description>&lt;P&gt;No you don't, a datastep is a loop over the observations, hence any code in a datastep is inherently used in a loop.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To post a question to get acurate answers do the following:&lt;/P&gt;
&lt;P&gt;1) Post test data in the form of a datastep using the {i} code window&lt;/P&gt;
&lt;P&gt;2) Post example output required&lt;/P&gt;
&lt;P&gt;3) Explain the process&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2018 09:11:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438354#M109280</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-19T09:11:33Z</dc:date>
    </item>
    <item>
      <title>Re: calculation for every value (SUBJECT)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438357#M109282</link>
      <description>&lt;P&gt;&lt;BR /&gt;proc sql noprint ;&lt;BR /&gt;select count(distinct subjid) into: nobs from final ;&lt;BR /&gt;quit ;&lt;BR /&gt;%let nobs=&amp;amp;nobs ;&lt;BR /&gt;%put &amp;amp;nobs ;&lt;/P&gt;&lt;P&gt;%if &amp;amp;nobs ne 0 %then %do ;&lt;BR /&gt;data _null_;&lt;BR /&gt;set final ;&lt;BR /&gt;call symput("subjid"||strip(put(_n_,best.)), strip(subjid)) ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%do i=1 %to &amp;amp;nobs ;&lt;BR /&gt;options nobyline;&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;proc sgplot data=final(where=(subjid="&amp;amp;&amp;amp;subjid&amp;amp;i."))&lt;/P&gt;&lt;P&gt;..&lt;/P&gt;&lt;P&gt;..&lt;/P&gt;&lt;P&gt;..quit;&lt;BR /&gt;%end ;&lt;BR /&gt;%end ;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I Solved like this and thats working, thanks anyway .&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2018 09:29:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438357#M109282</guid>
      <dc:creator>Vahe_Mar</dc:creator>
      <dc:date>2018-02-19T09:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: calculation for every value (SUBJECT)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438359#M109283</link>
      <description>&lt;P&gt;Well, that at least is a small bit of information that would have helped us.&amp;nbsp; There are two methods for doing this which will result in smaller more robust code.&amp;nbsp; The first uses only base sas which is always 100% better than any code involving macro:&lt;/P&gt;
&lt;PRE&gt;data final;
  merge final sashelp.vtable (where=(libname="WORK" and memname="FINAL"));
  subjid=cats(put(nobs,best.),subjid);
run;

proc sgplot data=final;
  by subjid;

...
run;&lt;/PRE&gt;
&lt;P&gt;This uses by group processing - a fundamental basic technique for working with by groups so you don't have to rewrite it.&lt;/P&gt;
&lt;P&gt;The second uses some code generation:&lt;/P&gt;
&lt;PRE&gt;data final;
  merge final sashelp.vtable (where=(libname="WORK" and memname="FINAL"));
  subjid=cats(put(nobs,best.),subjid);
run;

data _null_;
  set final;
  call execute (cats('proc sgplot data=final (where=(subjid=',subjid,'));...;run;'));
run;&lt;/PRE&gt;
&lt;P&gt;This method you do not need loops or counters, the dataset itself will drive the number of iterations.&amp;nbsp; I would only go this way however if the by grouping does not do everything you need (those very rare circumstances) as by groups are more robust and simplfy the code a lot.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2018 09:34:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438359#M109283</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-19T09:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: calculation for every value (SUBJECT)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438360#M109284</link>
      <description>Thanks</description>
      <pubDate>Mon, 19 Feb 2018 09:37:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438360#M109284</guid>
      <dc:creator>Vahe_Mar</dc:creator>
      <dc:date>2018-02-19T09:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: calculation for every value (SUBJECT)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438379#M109289</link>
      <description>&lt;P&gt;There is actually a third way, second only to by grouping.&amp;nbsp; And this using dynamic variables in proc template.&amp;nbsp; Sgplot creates a template behind the scenes - you can see this using tmpltout option in sgplot.&amp;nbsp; Modify the template code somewhat:&lt;/P&gt;
&lt;PRE&gt;proc template;
...
  dynamic subj;
...
run;

proc sgrender...;
  dynamic subj=...;
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Feb 2018 12:05:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438379#M109289</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-19T12:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: calculation for every value (SUBJECT)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438380#M109290</link>
      <description>i have used gplot, and during this i have new problem, like every graph should have name part from SUBJD variable,&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Feb 2018 12:07:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438380#M109290</guid>
      <dc:creator>Vahe_Mar</dc:creator>
      <dc:date>2018-02-19T12:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: calculation for every value (SUBJECT)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438382#M109292</link>
      <description>&lt;P&gt;There is no need to use gplot, it is very old.&amp;nbsp; Use sgplot.&amp;nbsp; Please give examples of what you mean, test data, code, required output etc.&amp;nbsp; With a by group in sgplot it is simple:&lt;/P&gt;
&lt;PRE&gt;proc sgplot...;
  by subjid;
  title "The Subject: #byval1";
  ...;
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Feb 2018 12:10:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438382#M109292</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-19T12:10:18Z</dc:date>
    </item>
    <item>
      <title>Re: calculation for every value (SUBJECT)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438385#M109294</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 278px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18675iAE837C0D074C31DD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2018 12:23:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438385#M109294</guid>
      <dc:creator>Vahe_Mar</dc:creator>
      <dc:date>2018-02-19T12:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: calculation for every value (SUBJECT)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438386#M109295</link>
      <description>&lt;P&gt;&lt;FONT size="4"&gt;?&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2018 12:31:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438386#M109295</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-19T12:31:24Z</dc:date>
    </item>
    <item>
      <title>Re: calculation for every value (SUBJECT)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438388#M109296</link>
      <description>&lt;P&gt;should be patient 001&lt;/P&gt;&lt;P&gt;patient 002&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2018 12:32:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438388#M109296</guid>
      <dc:creator>Vahe_Mar</dc:creator>
      <dc:date>2018-02-19T12:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: calculation for every value (SUBJECT)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438392#M109299</link>
      <description>&lt;P&gt;Please review what I posted, particularly:&lt;/P&gt;
&lt;PRE&gt;  title "The Subject: #byval1";&lt;/PRE&gt;
&lt;P&gt;This is not&amp;nbsp;&lt;SPAN&gt;#subjid or anything else, but&amp;nbsp;#&amp;nbsp;byval1, indiccating the Value of the First by group variable.&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2018 13:28:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation-for-every-value-SUBJECT/m-p/438392#M109299</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-19T13:28:15Z</dc:date>
    </item>
  </channel>
</rss>

