Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Discussions
- :
- Using variable for control chart sample size

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Using variable for control chart sample size

Jun 16, 2011 3:02 PM
(1077 views)

I am trying to use a variable for a control chart sample size and it won't accept it. The following code works:

Samples=6;

tempchart=Control Chart(

Sample Label( :DateTime ),

Sample Size( 4) ,

KSigma( 3 ),

Chart Col( :Value, XBar, R ),save summaries);

but these do not:

Samples=6;

tempchart=Control Chart(

Sample Label( :DateTime ),

Sample Size( Samples) ,

KSigma( 3 ),

Chart Col( :Value, XBar, R ),save summaries);

Samples=6;

tempchart=Control Chart(

Sample Label( :DateTime ),

Sample Size( 4*6) ,

KSigma( 3 ),

Chart Col( :Value, XBar, R ),save summaries);

I have also tried sample size (eval(Samples)), but it doesn't work either.

Any ideas?

Samples=6;

tempchart=Control Chart(

Sample Label( :DateTime ),

Sample Size( 4) ,

KSigma( 3 ),

Chart Col( :Value, XBar, R ),save summaries);

but these do not:

Samples=6;

tempchart=Control Chart(

Sample Label( :DateTime ),

Sample Size( Samples) ,

KSigma( 3 ),

Chart Col( :Value, XBar, R ),save summaries);

Samples=6;

tempchart=Control Chart(

Sample Label( :DateTime ),

Sample Size( 4*6) ,

KSigma( 3 ),

Chart Col( :Value, XBar, R ),save summaries);

I have also tried sample size (eval(Samples)), but it doesn't work either.

Any ideas?

2 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Using variable for control chart sample size

I think this is a case where only literals are accepted. See my answer to

http://communities.sas.com/thread/30007?tstart=0

for a work-around.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Using variable for control chart sample size

Thanks for the post. I am still having problems with this. It looks like it is working correctly, but then the output is wrong. If I run the following script:

XBar_R_BL = 4;

TempChartExp=substitute(expr(Control Chart(

Sample Label( :DateTime ),

Sample Size( SAMPLESIZESUB1) ,

KSigma( 3 ),

Chart Col( :Value, XBar, R ),save summaries)),expr(SAMPLESIZESUB1),XBar_R_BL);

show(TempChartExp);

TempChart1 = eval (TempChartExp);

The show statement gives the following:

TempChartExp = Control Chart(Sample Label(:DateTime), Sample Size(4), KSigma(3), Chart Col(:Value, XBar, R), save summaries);

Which is exactly what I wanted. However, when the eval statement is executed, I get a data table with 1 row and a chart with one point. If I copy the script from the chart, I get:

Control Chart( Sample Label( :c000004 ), KSigma( 3 ), Chart Col( :Value, XBar, R ) )

So it has changed the column for the sample label and it has dropped the sample size al together. Any help is appreciated.