Hello All,
I am trying to run a simulation for the normality test. I have the following program which is running well. But I have a problem with output. It is always printing output tables of "proc univariate." When I use "NOPRINT" I received the same answer and warning "
%let N=10;
%let outlierPct=5;
%let NumSamples = 100;
data simulation(keep=sim y);
do sim=1 to &NumSamples; /* 1. create many samples */
call streaminit(12345);
outlierNb = round(&N.*&outlierPct./100);
do i = 1 to outlierNb;
y = rand("Normal",0,4);
output;
end;
do i = outlierNb+1 to &N.;
y = rand("Normal",0,1);
output;
end;
end;
run;
*ods listing close;
*ods select html close;
ods select TestsforNormality;
proc univariate data=simulation normaltest noprint ;
by sim;
var y;
ods output TestsforNormality=normaltest;
run;
*ods listing;
*ods html;
*create 0/1 variable for rejection of hyphotesis;
data normaltest;
set normaltest;
reject=(pValue<0.1);
run;
*calculate the chance of rejection;
proc means data=normaltest mean;
var reject;
class Test;
run;
Change to this:
ods select None;
proc univariate data=simulation normaltest;
by sim;
var y;
ods output TestsforNormality=normaltest;
run;
ods select all;
1. Remove noprint
2. add ODS SELECT NONE/ALL
You can do the same thing to PROC MEANS if necessary.
@kamal1 wrote:
Hello All,
I am trying to run a simulation for the normality test. I have the following program which is running well. But I have a problem with output. It is always printing output tables of "proc univariate." When I use "NOPRINT" I received the same answer and warning "
verify that the appropriate procedure options are used to produce the requested output object. For example, verifythat the NOPRINT option is not used." Without NOPRINT, It prints the proc univariate output so program stuck in the middle of the simulation. "I greatly appreciate any suggestions.%let N=10; %let outlierPct=5; %let NumSamples = 100; data simulation(keep=sim y); do sim=1 to &NumSamples; /* 1. create many samples */ call streaminit(12345); outlierNb = round(&N.*&outlierPct./100); do i = 1 to outlierNb; y = rand("Normal",0,4); output; end; do i = outlierNb+1 to &N.; y = rand("Normal",0,1); output; end; end; run; *ods listing close; *ods select html close; ods select TestsforNormality; proc univariate data=simulation normaltest noprint ; by sim; var y; ods output TestsforNormality=normaltest; run; *ods listing; *ods html; *create 0/1 variable for rejection of hyphotesis; data normaltest; set normaltest; reject=(pValue<0.1); run; *calculate the chance of rejection; proc means data=normaltest mean; var reject; class Test; run;
Change to this:
ods select None;
proc univariate data=simulation normaltest;
by sim;
var y;
ods output TestsforNormality=normaltest;
run;
ods select all;
1. Remove noprint
2. add ODS SELECT NONE/ALL
You can do the same thing to PROC MEANS if necessary.
@kamal1 wrote:
Hello All,
I am trying to run a simulation for the normality test. I have the following program which is running well. But I have a problem with output. It is always printing output tables of "proc univariate." When I use "NOPRINT" I received the same answer and warning "
verify that the appropriate procedure options are used to produce the requested output object. For example, verifythat the NOPRINT option is not used." Without NOPRINT, It prints the proc univariate output so program stuck in the middle of the simulation. "I greatly appreciate any suggestions.%let N=10; %let outlierPct=5; %let NumSamples = 100; data simulation(keep=sim y); do sim=1 to &NumSamples; /* 1. create many samples */ call streaminit(12345); outlierNb = round(&N.*&outlierPct./100); do i = 1 to outlierNb; y = rand("Normal",0,4); output; end; do i = outlierNb+1 to &N.; y = rand("Normal",0,1); output; end; end; run; *ods listing close; *ods select html close; ods select TestsforNormality; proc univariate data=simulation normaltest noprint ; by sim; var y; ods output TestsforNormality=normaltest; run; *ods listing; *ods html; *create 0/1 variable for rejection of hyphotesis; data normaltest; set normaltest; reject=(pValue<0.1); run; *calculate the chance of rejection; proc means data=normaltest mean; var reject; class Test; run;
Hi Reeza,
You are AWESOME!! Thank you so much replying my post in less than 3 min. It is perfect. You saved my time. If you know any article where I should look at for proc mean procedure, please let me know.
Thank you very much again.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.