The Elsmar Cove Wiki More Free Files The Elsmar Cove Forums Discussion Thread Index Post Attachments Listing Failure Modes Services and Solutions to Problems Elsmar cove Forums Main Page Elsmar Cove Home Page
Go Back   The Elsmar Cove Forum > Common Quality Assurance Processes and Tools > Quality Tools, Improvement and Analysis > Quality Assurance and Compliance Software Tools / Solutions > Using Minitab Software
Forum Username

Elsmar Cove Forum Visitor Notice(s)


Search the Elsmar Cove
Custom Search
Monitor the Elsmar Forum
Follow Marc & Elsmar
Elsmar Cove Forum RSS Feed  Marc Smith's Google+ Page  Marc Smith's Linked In Page   Marc Smith's Elsmar Cove YouTube Page  Marc Smith's Facebook Page  Elsmar Cove Twitter Feed
Elsmar Cove Groups
Elsmar Cove Google+ Group  Elsmar Cove LinkedIn Group  Elsmar Cove Facebook Group
Sponsor Links





Donate and $ Contributor Forum Access
Courtesy Quick Links

Links that Elsmar Cove visitors will find useful in your quest for knowledge:

Howard's
International Quality Services
Marcelo Antunes'
SQR Consulting
Bob Doering's
Correct SPC - Precision Machining

NIST's Engineering Statistics Handbook
IRCA - International Register of Certified Auditors
SAE - Society of Automotive Engineers
Quality Digest Portal
IEST - Institute of Environmental Sciences and Technology
ASQ - American Society for Quality
Reply
 
Thread Tools Search this Thread Rating: Thread Rating: 1 votes, 4.00 average. Display Modes
  #1  
Old 6th August 2009, 12:51 AM
Trippy Trippy is offline
Inactive Registered Visitor

 
Registration Date: Aug 2009
Location: New Zealand
 
Posts: 13
Thanks Given to Others: 4
Thanked 4 Times in 4 Posts
Karma Power: 21
Karma: 30
Trippy has less than 100 Karma points so far.
Please Help! Minitab - Getting a Minitab Macro to look up a Column Name

Please excuse me if there's a really obvious answer to this question. I work in local government, and somehow the job of finding a statistics package has fallen on my desk.

That being said, alhough I like how easy it is to use, i've been using the trial version of Minitab for about 3 days.

I'm in the process of writing a macro to compare box and whisker plots for water quality data for the last N samples against the total population of all samples collected to date, and referencing these box and whisker plots, which include custom quantiles, and 2SE Confidence intervals.

What i'm aiming for is a macro that my co-workers who have no little experience of statistics can use, so they can simply type in:
Code:
%COMPARE 'ANALYTE' N
And Minitab will do the rest of the work for them (as long as the first row of their spreadsheet is column names).

Here's what i've managed to figure out so far.
Code:
Macro
COMPARE ANALYTE1 J DATA1 DATA2 DATA3 DATA4
MCOLUMN ANALYTE1 ANALYTE2 DATA1 DATA2 DATA3 DATA4
Mconstant K1 K2 K3 K4 K5 K6 K7 K8 K9 K10 K11 K12 TEMP1 I J H
LET H=COUNT(ANALYTE1)
LET I=H-(J-1)
do I=I:H
  LET ANALYTE2[I]=ANALYTE1[I]
ENDDO
LET K1=PERCENTILE(ANALYTE1,DATA1[1])
LET K2=PERCENTILE(ANALYTE2,DATA1[1])
LET K3=MEAN(ANALYTE1)-STDEV(ANALYTE1)/SQRT(N(ANALYTE1))
LET K4=MEAN(ANALYTE1)+STDEV(ANALYTE1)/SQRT(N(ANALYTE1))
LET K5=MEAN(ANALYTE2)-STDEV(ANALYTE2)/SQRT(N(ANALYTE2))
LET K6=MEAN(ANALYTE2)+STDEV(ANALYTE2)/SQRT(N(ANALYTE2))
LET K7=CONCATENATE("Consent Limit - ",DATA2[1]," (",DATA3[1]," ",DATA4[1],")")
LET K8=CONCATENATE("Consent Limit - ",DATA2[2]," (",DATA3[2]," ",DATA4[2],")")
LET K9=DATA3[1]
LET K10=DATA3[2]
LET K11=EXP(AVERAGE(LOGTEN(ANALYTE1)))
LET K12=EXP(AVERAGE(LOGTEN(ANALYTE2)))
Boxplot ANALYTE1 ANALYTE2;
  Overlay;
  Proportional;
  SOffset;
  IQRBox;
  Outlier;
  Mean;
    Type 18;
    Size 1.5;
  Reference 2 K9;
    MODEL 1;
    Label K7;
  Reference 2 K10;
    MODEL 1;
    Label K8;
  Title;
  Footnote;
    FPanel;
  Marker 2 K6;
    Unit 1;
    Type 28;
    Color 2;
    Size 2;
  Marker 2 K5;
    Unit 1;
    Type 19;
    Color 2;
    Size 2;
  Marker 1 K4;
    Unit 1;
    Type 28;
    Color 2;
    Size 2;
  Marker 1 K3;
    Unit 1;
    Type 19;
    Color 2;
    Size 2;
  Marker 2 K2;
    Unit 1;
    Type 11;
    Color 2;
    Size 2;
  Marker 1 K1;
    Unit 1;
    Type 11;
    Color 2;
    Size 2;
  Marker 1 K11;
    Unit 1;
    Type 8;
    Color 16;
    Size 2;
  Marker 2 K12;
  NoDTitle.
endmacro
I've figured this much out by manually adding (for example) the points, and seeing what changes it made to the command code (Not to mention much perusing of help files).

What I need the help with is the most straight forward thing (I think) I can do is to say to people "Include the information relating to the permit limits under columns with these names", so that I can replace DATA1, DATA 2, DATA3, and DATA4 with those colum names, but so far everything i've tried has failed with a variety of error messages.

My question is this - How do I get a Macro to look up a column name, rather than a column number, without specifiying it in the commandline when I initiate the macro?

In other words, if I was executing it as an exec, or on the command line I would just type in:
Code:
LET K1=PERCENTILE(ANALYTE1,'PERCENTILE'[1])
But if I include that line in the macro it gives me the error message:
Code:
LET K1=PERCENTILE(ANALYTE1,'PERCENTILE'[1])
                           X
* ERROR * Cannot use quoted string to refer to macro variables
* ERROR * Completion of computation impossible.

Last edited by Trippy; 6th August 2009 at 12:56 AM.

Sponsored Links
  #2  
Old 8th August 2009, 05:30 PM
Miner's Avatar
Miner Miner is offline
Forum Moderator

 
Registration Date: Apr 2002
Location: Greater Milwaukee area, Wisconsin
 
Posts: 3,395
Thanks Given to Others: 591
Thanked 1,967 Times in 1,246 Posts
Blog Entries: 16
Karma Power: 424
Karma: 18279
Miner is appreciated, and has over 1700 Karma points.Miner is appreciated, and has over 1700 Karma points.
Miner is appreciated, and has over 1700 Karma points.Miner is appreciated, and has over 1700 Karma points.Miner is appreciated, and has over 1700 Karma points.
Re: Minitab Question - Getting a Macro to look up a column name

Bumped. Any takers?

__________________

"A fool can learn from his own experiences; the wise learn from the experience of others." - Democritus, 460-370 B.C.
Thanks to Miner for your informative Post and/or Attachment!
Sponsored Links

  #3  
Old 10th August 2009, 04:00 AM
Allattar Allattar is offline
Appreciated Member

 
Registration Date: Jan 2008
Location: UK
 
Posts: 234
Thanks Given to Others: 15
Thanked 170 Times in 111 Posts
Karma Power: 55
Karma: 3385
Allattar is appreciated, and has over 1700 Karma points.
Allattar is appreciated, and has over 1700 Karma points.Allattar is appreciated, and has over 1700 Karma points.Allattar is appreciated, and has over 1700 Karma points.Allattar is appreciated, and has over 1700 Karma points.
Re: Minitab Question - Getting a Macro to look up a column name

Without looking at anything, a simple answer is not to use column names.

Typing the command
%compare c1-c6

will send a command to Minitab to read in columns c1 through to c6. Referring to column c numbers rather than names.

You have to change the notation at the beginning of the macro to

Macro
COMPARE DATA.1-Data.n
MCOLUMN DATA.1-Data.n

That is the first one I can think of for the moment as a simpler solution.
Becuase a local macro reads the data into an internal worksheet you cannot then pull new columns in from outside the macro unless they where sent to the Macro at the start.

What can work instead is using an Exec (basically a mini macro with no headers, just the command language) to read in the columns in the worksheet and then send them to the Macro.

Of course then I have to remember the command for counting columns in the worksheet.
Thank You to Allattar for your informative Post and/or Attachment!
  #4  
Old 10th August 2009, 09:59 PM
Trippy Trippy is offline
Inactive Registered Visitor

 
Registration Date: Aug 2009
Location: New Zealand
 
Posts: 13
Thanks Given to Others: 4
Thanked 4 Times in 4 Posts
Karma Power: 21
Karma: 30
Trippy has less than 100 Karma points so far.
Re: Minitab Question - Getting a Macro to look up a column name

Quote:
In Reply to Parent Post by Allattar View Post

Without looking at anything, a simple answer is not to use column names.

Typing the command
%compare c1-c6

will send a command to Minitab to read in columns c1 through to c6. Referring to column c numbers rather than names.

You have to change the notation at the beginning of the macro to

Macro
COMPARE DATA.1-Data.n
MCOLUMN DATA.1-Data.n

That is the first one I can think of for the moment as a simpler solution.
Becuase a local macro reads the data into an internal worksheet you cannot then pull new columns in from outside the macro unless they where sent to the Macro at the start.

What can work instead is using an Exec (basically a mini macro with no headers, just the command language) to read in the columns in the worksheet and then send them to the Macro.

Of course then I have to remember the command for counting columns in the worksheet.
Thanks for the feedback, I greatly appreciate the help.

I emailed minitab support, and they said to use KKSET, but that seems to be creating a different error within the macro (something along the lines of inappropriate use of text).
With using this:
Code:
Macro
COMPARE DATA.1-Data.n
MCOLUMN DATA.1-Data.n
Does the column range have to start at one, or is that just a notational convention?

For example, if I was to use:
Code:
Macro
COMPARE DATA.1-Data.n
MCOLUMN DATA.1-Data.n
But then type in COMPARE C33-C36 would that still work?
If it does, that would be (potentially) an ideal solution, as long as I can use a DO/ENDDO loop to read consecutive columns at the same row.
  #5  
Old 10th August 2009, 10:27 PM
Trippy Trippy is offline
Inactive Registered Visitor

 
Registration Date: Aug 2009
Location: New Zealand
 
Posts: 13
Thanks Given to Others: 4
Thanked 4 Times in 4 Posts
Karma Power: 21
Karma: 30
Trippy has less than 100 Karma points so far.
Re: Minitab Question - Getting a Macro to look up a column name

Actually, on second thoughts, ignor emy last post, a little bit of trial and error answered my questions.
  #6  
Old 11th August 2009, 04:22 AM
Allattar Allattar is offline
Appreciated Member

 
Registration Date: Jan 2008
Location: UK
 
Posts: 234
Thanks Given to Others: 15
Thanked 170 Times in 111 Posts
Karma Power: 55
Karma: 3385
Allattar is appreciated, and has over 1700 Karma points.
Allattar is appreciated, and has over 1700 Karma points.Allattar is appreciated, and has over 1700 Karma points.Allattar is appreciated, and has over 1700 Karma points.Allattar is appreciated, and has over 1700 Karma points.
Re: Minitab Question - Getting a Macro to look up a column name

Ok glad it works.

A quick way to see how the notation works is to use the following.

Macro
Hist x.1-x.n
mcolumn x.1-x.n
mconstant i
do i = 1:n
histogram x.i
enddo
endmacro

Yes there are simpler ways to create a lot of histograms but it is just to highlight how the array of columns works. As you should have seen by now you can use any range of columns.
Thanks to Allattar for your informative Post and/or Attachment!
  #7  
Old 13th August 2009, 09:32 PM
Trippy Trippy is offline
Inactive Registered Visitor

 
Registration Date: Aug 2009
Location: New Zealand
 
Posts: 13
Thanks Given to Others: 4
Thanked 4 Times in 4 Posts
Karma Power: 21
Karma: 30
Trippy has less than 100 Karma points so far.
Re: Minitab - Getting a Minitab Macro to look up a Column Name

I wound up converting it to a global macro (once I realized the coding for a global macro was essentially the same as an exec file), and wound up using CK notation, and prompting for user input (friendlier for my coworkers, they click a button, answer some questions, and get their graph).

I could post the code, once i've cleaned it up a little (still one very small bug needs squished, and some profane 'NOTE's need removed (what can I say, I got bored with 'NOTE HELLO 1' as a fault finding tool).

One question though, is it possible to use conditional statements on a subcommand for a graph, or do you need to do that external to the graphing command.
Thanks to Trippy for your informative Post and/or Attachment!
  #8  
Old 14th August 2009, 03:29 AM
Allattar Allattar is offline
Appreciated Member

 
Registration Date: Jan 2008
Location: UK
 
Posts: 234
Thanks Given to Others: 15
Thanked 170 Times in 111 Posts
Karma Power: 55
Karma: 3385
Allattar is appreciated, and has over 1700 Karma points.
Allattar is appreciated, and has over 1700 Karma points.Allattar is appreciated, and has over 1700 Karma points.Allattar is appreciated, and has over 1700 Karma points.Allattar is appreciated, and has over 1700 Karma points.
Re: Minitab - Getting a Minitab Macro to look up a Column Name

I find im very boring when error checking with note.

Note 1
Note 2
Note 3
etc...
But its very powerful to help you find where the macro stops.

Of course if you where feeling very adventurious you could leave the Local macro in place as it is, but use a global macro to get the user input and fire that to the local.
Thanks to Allattar for your informative Post and/or Attachment!
Reply

Lower Navigation Bar
Go Back   The Elsmar Cove Forum > Common Quality Assurance Processes and Tools > Quality Tools, Improvement and Analysis > Quality Assurance and Compliance Software Tools / Solutions > Using Minitab Software

Do you find this discussion thread helpful and informational?


Bookmarks


Visitors Currently Viewing this Thread: 1 (0 Registered Visitors (Members) and 1 Unregistered Guest Visitors)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Forum Search
Display Modes Rate Thread Content
Rate Thread Content:

Forum Posting Settings
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Discussion Threads
Discussion Thread Title Thread Starter Forum Replies Last Post or Poll Vote
Minitab macro vs. Layout tool MiniNik Using Minitab Software 9 21st November 2012 02:47 AM
Insert Empty Column Using Minitab Macro MinitabNewbie Using Minitab Software 2 6th July 2011 04:08 PM
Minitab Macro-Command 'NUMERIC' to convert a text column to an numeric column Makiaveli Using Minitab Software 8 10th August 2009 05:34 AM
Problem creating a Macro in Minitab Minitab_Novoice Using Minitab Software 4 4th January 2009 09:57 AM
Macro to connect to Access Database to get to data - Minitab Macro help minitabuser Using Minitab Software 1 12th November 2008 04:54 PM



The time now is 02:49 PM. All times are GMT -4.
Your time zone can be changed in your UserCP --> Options.


   


Marc Timothy Smith - Elsmar.com
8466 LeSourdsville-West Chester Road, Olde West Chester, Ohio 45069-1929
513 341-6272