<?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: sas macro language programing in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/sas-macro-language-programing/m-p/232394#M12220</link>
    <description>&lt;P&gt;Before you proceed you might want to read a little bit about how to perform efficient simulation in SAS.&lt;/P&gt;
&lt;P&gt;As a general rule, you should avoid using macro loops to "drive" the simulation of multiple samples.&lt;/P&gt;
&lt;P&gt;See the article &lt;A href="http://blogs.sas.com/content/iml/2012/07/18/simulation-in-sas-the-slow-way-or-the-by-way.html" target="_self"&gt;"Simulation in SAS: The slow way or the BY way."&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this is a classroom exercise and you are REQUIRED to use macro, then let us know. We can address your programming errors and give you hints without writing the program for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this is not a classroom exercise, then this problem does not require any macro code.&amp;nbsp; The link I've provided includes SAS code that generates multiple samples. The example uses the uniform distribution, but can be easily modified to use the normal distribution.&lt;/P&gt;</description>
    <pubDate>Fri, 30 Oct 2015 09:58:01 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2015-10-30T09:58:01Z</dc:date>
    <item>
      <title>sas macro language programing</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/sas-macro-language-programing/m-p/232372#M12218</link>
      <description>&lt;P&gt;hello.&lt;/P&gt;&lt;P&gt;please look at my coding and correct my mistake.i want to generate 100 samples from a normal distribution with mean of 0 and standard deviation of 10 and&amp;nbsp; construct two 95% confidence intevals for the mean under assumption of known variance and unknown variance seperately&amp;nbsp; for each sample and mark thoes intervals that do not cover mean 0 ,by three stars***. i want to have 20 observations for this prosse.i want to use sas macro language.&lt;/P&gt;&lt;P&gt;&amp;nbsp;here is my coding:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data x;&lt;BR /&gt;input mean n std upcl lowcl alpha=alpha t0 z0 tu tl zu zl;&lt;BR /&gt;datalines;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%macro mymac;&lt;BR /&gt;%let macvar=one;&lt;BR /&gt;%do j=1 to 20;&lt;BR /&gt;data one;&lt;BR /&gt;%do i=1 %to 100;&lt;BR /&gt;%let x=rannor(-1)*10+0;&lt;BR /&gt;%output;&lt;BR /&gt;label &amp;amp;x='';&lt;BR /&gt;%end;&lt;BR /&gt;&lt;BR /&gt;%let dat=mycvar;&lt;BR /&gt;proc means data=&amp;amp;dat mean clm std n;&lt;BR /&gt;%run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data two ;&lt;BR /&gt;set stat (drop =_TYPE_ _FREQ_);&lt;BR /&gt;alpha =.05;&lt;BR /&gt;t0=tinv(1-alpha/2,n-1);&lt;BR /&gt;z0=probit(1-alpha/2);&lt;BR /&gt;zu=mean+z0*(10)/sqrt(n);&lt;BR /&gt;zl=mean-z0*(10)/sqrt(n);&lt;BR /&gt;tu=mean+t0*std/sqrt(n);&lt;BR /&gt;tl=mean-t0*std/sqrt(n);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%let lc=lc;&lt;BR /&gt;%let uc=uc;&lt;/P&gt;&lt;P&gt;%let b=&amp;amp;lc*&amp;amp;uc;&lt;/P&gt;&lt;P&gt;%let eval_b=%eval(&amp;amp;b);&lt;/P&gt;&lt;P&gt;%put &amp;amp;b is &amp;amp;eval_b;&lt;/P&gt;&lt;P&gt;%macro compare(b,0);&lt;BR /&gt;%if &amp;amp;b&amp;gt;0 %then %put label &amp;amp;x='***';&lt;BR /&gt;%else %if &amp;amp;b&amp;lt;0 %then %put label &amp;amp;x='';&lt;BR /&gt;&lt;BR /&gt;%mend compare;&lt;BR /&gt;%compare(0,&amp;amp;b)&lt;/P&gt;&lt;P&gt;%end ;&lt;BR /&gt;%mend;&lt;/P&gt;&lt;P&gt;proc append base=x data=two;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data print;&lt;BR /&gt;call execute('proc print data=mymac;run;');&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Oct 2015 03:56:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/sas-macro-language-programing/m-p/232372#M12218</guid>
      <dc:creator>fatemeh</dc:creator>
      <dc:date>2015-10-30T03:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: sas macro language programing</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/sas-macro-language-programing/m-p/232394#M12220</link>
      <description>&lt;P&gt;Before you proceed you might want to read a little bit about how to perform efficient simulation in SAS.&lt;/P&gt;
&lt;P&gt;As a general rule, you should avoid using macro loops to "drive" the simulation of multiple samples.&lt;/P&gt;
&lt;P&gt;See the article &lt;A href="http://blogs.sas.com/content/iml/2012/07/18/simulation-in-sas-the-slow-way-or-the-by-way.html" target="_self"&gt;"Simulation in SAS: The slow way or the BY way."&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this is a classroom exercise and you are REQUIRED to use macro, then let us know. We can address your programming errors and give you hints without writing the program for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this is not a classroom exercise, then this problem does not require any macro code.&amp;nbsp; The link I've provided includes SAS code that generates multiple samples. The example uses the uniform distribution, but can be easily modified to use the normal distribution.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Oct 2015 09:58:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/sas-macro-language-programing/m-p/232394#M12220</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-10-30T09:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: sas macro language programing</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/sas-macro-language-programing/m-p/232432#M12232</link>
      <description>&lt;P&gt;You might also want to look at using&lt;/P&gt;
&lt;P&gt;x = rand('NORMAL', 1, 10);&lt;/P&gt;
&lt;P&gt;This lets you specify mean and standard deviation directly.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Oct 2015 14:29:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/sas-macro-language-programing/m-p/232432#M12232</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-10-30T14:29:59Z</dc:date>
    </item>
  </channel>
</rss>

