I'm making a pChart using PROC SHEWHART, and my subgroups (lots) have varying sizes. I want to give each lot the same weight when calculating pbar, rather than let lots with larger sample sizes have more weight.
I assumed PROC SHEWHART would have a WEIGHT statement, but it does not. My next thought is to calculate pbar myself, and then pass the value to SHEWHART via the p0 option on the pchart statement. Does this seem like a reasonable approach?
As an example, given data like:
data have ;
input lot pfailed ntested ;
cards ;
1 .1 20
2 .2 20
3 .1 20
4 .2 20
5 .4 60
;
PROC SHEWHART will calculate pbar as a weighted mean of the proportions, giving lot 5 more weight than the other lots, and you get pbar=.26.
proc shewhart data=have ;
pchart pfailed*lot/subgroupn=ntested dataunit=proportion;
run ;
My thought is to calculate pbar myself as the unweighted mean, and you get pbar=.2, and pass that value to PROC SHEWHART:
proc sql noprint;
select mean(pfailed) into :pbar trimmed
from have
;
quit ;
%put &=pbar ;
proc shewhart data=have ;
pchart pfailed*lot/subgroupn=ntested dataunit=proportion p0=&pbar;
run ;
... View more
I'm trying to strip some operators from a string, leaving behind variable names. I'm using the following code which doesn't work. Is there some quoting needed?
%let expression = vara / (varb + varc);
%macro stripsym(string);
%sysfunc(translate(&string,,+-*/()));
%mend stripsym;
%put Output: %stripsym(&expression);
%put Desired: vara varb varc;
... View more
Hi, I would like to apply two floors to the existing dataset below (Col1 values are sorted): 1) For any values in Col1 ❤️ replace their values in Col2 with that for Col1 =3; 1) For any values in Col1 >4 replace their values in Col2 with that for Col1 =4; Many thanks in advance. data have; input Col1 Col2; datalines; 1 1 2 2 3 3 4 4 5 3 6 2 7 1 ; data want; Col1 Col2; 1 3 2 3 3 3 4 4 5 4 6 4 7 4
... View more
when use proc logistic procedure to set up default model in bank risk analysis, for the current customer, there are 4 kinds of results after application for the loan, accept, refuse , cancel or nouse. when set up model, to analysis if new customer will default or could approve their application of loan, we will use the current customer loan history. refused=1, accept=0 but how to deal with cancel and nouse, i think nouse looked as accepted, but for cancel, how to deal with it?
... View more