@kerowynmaria wrote:
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.
my code looks like :
%let n=20;*this is the size of each sample; %let sims=10;*this is for the outer loop that says how many times the simulation is repeated; %let df=6;*parameters needed; %let t=1.94; *t value for a ttest with a df of 6; data confidence(keep=missright missleft); set sample; lb=xbar-(t*(std/(sqrt(n)))); ub=xbar+(t*(std/(sqrt(n)))); if x < lb then output 'E:\missleft'; if x > ub then output 'E:\missright'; miss='E:\missright'+'E:\missleft'; output; end; proc print; run;
for the missleft and missright is where i see the problem. How do I fix this?
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.
Data missleft missright;
if x< lb then output missleft;
if x> ub then output missright;
If you want to create a numeric variable it would be something like
missleft = <some numeric operation>; from what I see that might be something like
if x<lb then missleft=x;
if x> ub then missright=x;
miss='E:\missright'+'E:\missleft';
Addition with text elements (things between quotes) is not allowed in SAS. Addition would require the creation of numeric variables.
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.
... View more