<?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: T Test for random distribution in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/T-Test-for-random-distribution/m-p/422158#M103805</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/182948"&gt;@kerowynmaria&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I have a sample t distribution and for my sample I have to figure out confidence intervals along with their upper and loew bounds. I figured out the formula to determine the upper and lower bounds but when I do an if then to see what from my sample is a miss it tells me :ERROR 455-185: Data set was not specified on the DATA statement.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;my code looks like :&lt;/P&gt;
&lt;P&gt;%let n=20;*this is the size of each sample;&lt;BR /&gt;%let sims=10;*this is for the outer loop that says how many times the simulation is repeated;&lt;BR /&gt;%let df=6;*parameters needed;&lt;BR /&gt;%let t=1.94; *t value for a ttest with a df of 6;&lt;BR /&gt;data confidence(keep=missright missleft);&lt;BR /&gt;set sample;&lt;BR /&gt;lb=xbar-(t*(std/(sqrt(n))));&lt;BR /&gt;ub=xbar+(t*(std/(sqrt(n))));&lt;BR /&gt;&lt;FONT size="4"&gt;&lt;FONT color="#ff0000"&gt;&lt;FONT color="#000000"&gt;if x &amp;lt; lb then&lt;/FONT&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#ff0000"&gt;output 'E:\missleft';&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4"&gt;&lt;FONT color="#ff0000"&gt;&lt;FONT color="#000000"&gt;if x &amp;gt; ub then&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#ff0000"&gt; output 'E:\missright';&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#ff0000"&gt;miss='E:\missright'+'E:\missleft';&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;proc print; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for the missleft and missright is where i see the problem. How do I fix this?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The syntax highlighted in red is not legal. OUTPUT requires a data set specified on the DATA statement. The OUTPUT statement send values to a dataset.&lt;/P&gt;
&lt;P&gt;Data&amp;nbsp; missleft missright;&lt;/P&gt;
&lt;P&gt;if x&amp;lt; lb then output missleft;&lt;/P&gt;
&lt;P&gt;if x&amp;gt; ub then output missright;&lt;/P&gt;
&lt;P&gt;If you want to create a numeric variable it would be something like&lt;/P&gt;
&lt;P&gt;missleft = &amp;lt;some numeric operation&amp;gt;; from what I see that might be something like&lt;/P&gt;
&lt;P&gt;if x&amp;lt;lb then missleft=x;&lt;/P&gt;
&lt;P&gt;if x&amp;gt; ub then missright=x;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#ff0000" size="4"&gt;miss='E:\missright'+'E:\missleft';&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Addition with text elements (things between quotes)&amp;nbsp;is not allowed in SAS. Addition would require the creation of numeric variables.&lt;/P&gt;
&lt;P&gt;I don't understand why you want to add rissright and missleft, one would likely be missing for every record and both could be missing for the majority of records.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Dec 2017 22:43:15 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-12-18T22:43:15Z</dc:date>
    <item>
      <title>T Test for random distribution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/T-Test-for-random-distribution/m-p/421830#M103735</link>
      <description>&lt;P&gt;I have a sample t distribution and for my sample I have to figure out confidence intervals along with their upper and loew bounds. I figured out the formula to determine the upper and lower bounds but when I do an if then to see what from my sample is a miss it tells me :ERROR 455-185: Data set was not specified on the DATA statement.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;my code looks like :&lt;/P&gt;&lt;P&gt;%let n=20;*this is the size of each sample;&lt;BR /&gt;%let sims=10;*this is for the outer loop that says how many times the simulation is repeated;&lt;BR /&gt;%let df=6;*parameters needed;&lt;BR /&gt;%let t=1.94; *t value for a ttest with a df of 6;&lt;BR /&gt;data confidence(keep=missright missleft);&lt;BR /&gt;set sample;&lt;BR /&gt;lb=xbar-(t*(std/(sqrt(n))));&lt;BR /&gt;ub=xbar+(t*(std/(sqrt(n))));&lt;BR /&gt;if x &amp;lt; lb then output 'E:\missleft';&lt;BR /&gt;if x &amp;gt; ub then output 'E:\missright';&lt;BR /&gt;miss='E:\missright'+'E:\missleft';&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;proc print; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for the missleft and missright is where i see the problem. How do I fix this?&lt;/P&gt;</description>
      <pubDate>Sun, 17 Dec 2017 07:20:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/T-Test-for-random-distribution/m-p/421830#M103735</guid>
      <dc:creator>kerowynmaria</dc:creator>
      <dc:date>2017-12-17T07:20:30Z</dc:date>
    </item>
    <item>
      <title>Statistical Computing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/T-Test-for-random-distribution/m-p/421828#M103742</link>
      <description>&lt;P&gt;I have a sample t distribution and for my sample I have to figure out confidence intervals along with their upper and loew bounds. I figured out the formula to determine the upper and lower bounds but when I do an if then to see what from my sample is a miss it tells me :ERROR 455-185: Data set was not specified on the DATA statement.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;my code looks like :&lt;/P&gt;&lt;P&gt;%let n=20;*this is the size of each sample;&lt;BR /&gt;%let sims=10;*this is for the outer loop that says how many times the simulation is repeated;&lt;BR /&gt;%let df=6;*parameters needed;&lt;BR /&gt;%let t=1.94; *t value for a ttest with a df of 6;&lt;BR /&gt;data confidence(keep=missright missleft);&lt;BR /&gt;set sample;&lt;BR /&gt;lb=xbar-(t*(std/(sqrt(n))));&lt;BR /&gt;ub=xbar+(t*(std/(sqrt(n))));&lt;BR /&gt;if x &amp;lt; lb then output 'E:\missleft';&lt;BR /&gt;if x &amp;gt; ub then output 'E:\missright';&lt;BR /&gt;miss='E:\missright'+'E:\missleft';&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;proc print; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for the missleft and missright is where i see the problem. How do I fix this?&lt;/P&gt;</description>
      <pubDate>Sun, 17 Dec 2017 06:49:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/T-Test-for-random-distribution/m-p/421828#M103742</guid>
      <dc:creator>kerowynmaria</dc:creator>
      <dc:date>2017-12-17T06:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: T Test for random distribution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/T-Test-for-random-distribution/m-p/421832#M103736</link>
      <description>&lt;P&gt;There are a few things here..&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) What does your sample data set look like?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) You initialize 4 macro variables at the top of your program but does not use them anywhere? Remember that when you want to reference the macro variable n, type &amp;amp;n.. Also, you do not use your df or sims macro variable anywhere?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) You have not specified the&amp;nbsp;&lt;SPAN&gt;missright and missleft data sets in your data step. Thus you can not write to them like that. And therefore you get the error. I don't think you should output to several data sets when your x variable is not inside the confidence interval. Simply make another variable that indicates where the x value falls.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Without having seen your sample data set, I think your code should look something like this (given that xbar and x are both variables in your sample data set)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let n=20;
%let t=1.94;

data confidence;
   set sample;
   missleft=0;
   missright=0;

   lb=xbar-(&amp;amp;t*(std/(sqrt(&amp;amp;n))));  
   ub=xbar+(&amp;amp;t*(std/(sqrt(&amp;amp;n))));
   if x &amp;lt; lb then missleft=1;
   if x &amp;gt; ub then missright=1;
end;

proc print data=confidence; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Dec 2017 09:20:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/T-Test-for-random-distribution/m-p/421832#M103736</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-12-17T09:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: Statistical Computing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/T-Test-for-random-distribution/m-p/421840#M103743</link>
      <description>&lt;P&gt;When you say OUTPUT with a name, it needs to be a SAS data set name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data a b;&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;output a;&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;output b;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Start by figuring out how many data sets you want to make.&amp;nbsp; Probably one.&amp;nbsp; Get rid of all of the E: file references. It looks like you are mixing up variable names and files.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Dec 2017 14:26:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/T-Test-for-random-distribution/m-p/421840#M103743</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2017-12-17T14:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: Statistical Computing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/T-Test-for-random-distribution/m-p/421841#M103744</link>
      <description>&lt;P&gt;See my answer to your original post here&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/Base-SAS-Programming/T-Test-for-random-distribution/m-p/421830#M103735" target="_blank"&gt;https://communities.sas.com/t5/Base-SAS-Programming/T-Test-for-random-distribution/m-p/421830#M103735&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Dec 2017 14:37:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/T-Test-for-random-distribution/m-p/421841#M103744</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-12-17T14:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: Statistical Computing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/T-Test-for-random-distribution/m-p/421872#M103745</link>
      <description>&lt;P&gt;I merged the related threads.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Dec 2017 19:29:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/T-Test-for-random-distribution/m-p/421872#M103745</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-12-17T19:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: T Test for random distribution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/T-Test-for-random-distribution/m-p/422158#M103805</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/182948"&gt;@kerowynmaria&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I have a sample t distribution and for my sample I have to figure out confidence intervals along with their upper and loew bounds. I figured out the formula to determine the upper and lower bounds but when I do an if then to see what from my sample is a miss it tells me :ERROR 455-185: Data set was not specified on the DATA statement.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;my code looks like :&lt;/P&gt;
&lt;P&gt;%let n=20;*this is the size of each sample;&lt;BR /&gt;%let sims=10;*this is for the outer loop that says how many times the simulation is repeated;&lt;BR /&gt;%let df=6;*parameters needed;&lt;BR /&gt;%let t=1.94; *t value for a ttest with a df of 6;&lt;BR /&gt;data confidence(keep=missright missleft);&lt;BR /&gt;set sample;&lt;BR /&gt;lb=xbar-(t*(std/(sqrt(n))));&lt;BR /&gt;ub=xbar+(t*(std/(sqrt(n))));&lt;BR /&gt;&lt;FONT size="4"&gt;&lt;FONT color="#ff0000"&gt;&lt;FONT color="#000000"&gt;if x &amp;lt; lb then&lt;/FONT&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#ff0000"&gt;output 'E:\missleft';&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4"&gt;&lt;FONT color="#ff0000"&gt;&lt;FONT color="#000000"&gt;if x &amp;gt; ub then&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#ff0000"&gt; output 'E:\missright';&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#ff0000"&gt;miss='E:\missright'+'E:\missleft';&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;proc print; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for the missleft and missright is where i see the problem. How do I fix this?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The syntax highlighted in red is not legal. OUTPUT requires a data set specified on the DATA statement. The OUTPUT statement send values to a dataset.&lt;/P&gt;
&lt;P&gt;Data&amp;nbsp; missleft missright;&lt;/P&gt;
&lt;P&gt;if x&amp;lt; lb then output missleft;&lt;/P&gt;
&lt;P&gt;if x&amp;gt; ub then output missright;&lt;/P&gt;
&lt;P&gt;If you want to create a numeric variable it would be something like&lt;/P&gt;
&lt;P&gt;missleft = &amp;lt;some numeric operation&amp;gt;; from what I see that might be something like&lt;/P&gt;
&lt;P&gt;if x&amp;lt;lb then missleft=x;&lt;/P&gt;
&lt;P&gt;if x&amp;gt; ub then missright=x;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#ff0000" size="4"&gt;miss='E:\missright'+'E:\missleft';&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Addition with text elements (things between quotes)&amp;nbsp;is not allowed in SAS. Addition would require the creation of numeric variables.&lt;/P&gt;
&lt;P&gt;I don't understand why you want to add rissright and missleft, one would likely be missing for every record and both could be missing for the majority of records.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 22:43:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/T-Test-for-random-distribution/m-p/422158#M103805</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-12-18T22:43:15Z</dc:date>
    </item>
  </channel>
</rss>

