<?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: help with sas code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/help-with-sas-code/m-p/260276#M50477</link>
    <description>Do you understand your current code? It appears to loop from 1 to nc=12 already. &lt;BR /&gt;&lt;BR /&gt;Are you looking to change that loop from 10 to 100 instead? &lt;BR /&gt;&lt;BR /&gt;Or add another loop to iterate everthing from 10 to 100? &lt;BR /&gt;&lt;BR /&gt;If so, you can add another outer loop for the nc variable and then you can add a BY nc to your proc means.</description>
    <pubDate>Thu, 31 Mar 2016 01:08:33 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-03-31T01:08:33Z</dc:date>
    <item>
      <title>help with sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help-with-sas-code/m-p/260274#M50476</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have code to find mean of cv_hat (coverage value) and cv_curl:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Data propns;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;seed = 123475;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;nr = 10000; nc = 12;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;array x[20];&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;zstar = abs ( probit(0.025) );&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;ppop = 0.5;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;do r = 1 to nr;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;do c = 1 to nc;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;x[c] = ranbin(seed, 1, ppop);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;nh = sum(of x[*]);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;phat = nh / nc;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;se_phat = sqrt( phat * (1-phat) / nc);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;pcurl = (nh + 2)/(nc + 4);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;se_pcurl = sqrt( pcurl * (1-pcurl) / (nc+4) );&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;zhat = (phat - ppop)/se_phat;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;zcurl = (pcurl - ppop)/se_pcurl;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;if abs(zhat) &amp;lt;= zstar then cv_hat = 1;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;else cv_hat = 0;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;if abs(zcurl) &amp;lt;= zstar then cv_curl = 1;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;else cv_curl = 0;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;output;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;keep phat se_phat pcurl se_pcurl zhat zcurl cv_hat cv_curl;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PROC means data = propns n mean stderr;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;var cv_hat cv_curl;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is code for nc=12. I need for : from 10 to 100. Therefore, i need 91 means for cv_hat and &amp;nbsp;cv_hat. Moreover, i need a graph&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;means|&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|_______________&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; nc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;P.S. Please show me how change my code (how use loop)&lt;/P&gt;&lt;P&gt;|&lt;/P&gt;&lt;P&gt;|&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 00:43:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help-with-sas-code/m-p/260274#M50476</guid>
      <dc:creator>bigban777</dc:creator>
      <dc:date>2016-03-31T00:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: help with sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help-with-sas-code/m-p/260276#M50477</link>
      <description>Do you understand your current code? It appears to loop from 1 to nc=12 already. &lt;BR /&gt;&lt;BR /&gt;Are you looking to change that loop from 10 to 100 instead? &lt;BR /&gt;&lt;BR /&gt;Or add another loop to iterate everthing from 10 to 100? &lt;BR /&gt;&lt;BR /&gt;If so, you can add another outer loop for the nc variable and then you can add a BY nc to your proc means.</description>
      <pubDate>Thu, 31 Mar 2016 01:08:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help-with-sas-code/m-p/260276#M50477</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-31T01:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: help with sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help-with-sas-code/m-p/260277#M50478</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data PROPNS;
  array X[100];
  SEED  = 123475;
  NR    = 10000;
  PPOP  = 0.5;
  ZSTAR = abs ( probit(0.025) );
  do NC = 10 to 100;
    call missing (of X[*]);
    do R = 1 to NR;
      do C = 1 to NC;
        X[C]    = ranbin(SEED, 1, PPOP);
        NH      = sum(of X[*]);
        PHAT    = NH / NC;
        SE_PHAT = sqrt( PHAT * (1-PHAT) / NC);
        PCURL   = (NH + 2)/(NC + 4);
        SE_PCURL= sqrt( PCURL * (1-PCURL) / (NC+4) );
        ZHAT    = divide(PHAT  - PPOP, SE_PHAT );
        ZCURL   = divide(PCURL - PPOP, SE_PCURL);
        CV_HAT  = (abs(ZHAT) &amp;lt;= ZSTAR );
        CV_CURL = (abs(ZCURL) &amp;lt;= ZSTAR);
      end;
      output;
    end;
  end;
  keep NC PHAT SE_PHAT PCURL SE_PCURL ZHAT ZCURL CV_HAT CV_CURL;
run;

proc means data = PROPNS n mean stderr nway;
  class NC;
  var CV_HAT CV_CURL;
  output out=SUM mean= ;
run;

proc gplot data=SUM;
  plot (CV_HAT CV_CURL)*NC/overlay;
  run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Mar 2016 01:17:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help-with-sas-code/m-p/260277#M50478</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2016-03-31T01:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: help with sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help-with-sas-code/m-p/260286#M50479</link>
      <description>&lt;P&gt;I got this. Thank you so much. Could you show me how label each line( red and blue) and it shows just CV_HAT, i believ should be CV_HAT, CV_CURL.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/2564i614FED72EBC54F0D/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="snap.PNG" title="snap.PNG" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 02:01:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help-with-sas-code/m-p/260286#M50479</guid>
      <dc:creator>bigban777</dc:creator>
      <dc:date>2016-03-31T02:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: help with sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help-with-sas-code/m-p/260296#M50483</link>
      <description>&lt;P&gt;Look at the legend option and statement,&amp;nbsp;and at the axis statement.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 02:35:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help-with-sas-code/m-p/260296#M50483</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2016-03-31T02:35:23Z</dc:date>
    </item>
  </channel>
</rss>

