Problem creating a Macro in Minitab

M

Minitab_Novoice

Hi All,
I am new to This forum as well as writing macros for MINITAB
I have a situation in which i need to generate a graph with two columns
like count in one column and one more variable in other column

when i try to do this manually i get the graph and in history i see the following commands

Chart ( 'Known Sales' ) * 'Description';
Summarized;
DatLab 'Warranty Claims as Percent of K';
Bar.

i tried to build a macro with this info, something like this

GMACRO
STARTUP
read C1-C3;
file "C:\Documents and Settings\mp55266\Desktop\MINITAB.14\Macros\abc.txt";
TAB.
Description C1;
Known Sales C2;
Warranty Claims as Percent of Known Sales C3;
Chart 'Known Sales' * 'Warranty Claims as Percent of K';
Summarized.
ENDMACRO

and i get the following error
* ERROR * A numeric or date/time column must be specified.

* ERROR * Macro exiting...

could somebody please help me out in creating this macro..
it is infact very crucial for me to complete this macro

Thanks !!
 
S

SPCGeek2

I like your approach to creating this macro. It is crucial whenever you try to automate something to first do it manually to get the steps needed to automate so you are ahead of the curve in creating Minitab Macros. The problem with the macro and the reason Minitab is stopping and displaying the error is your syntax for the naming of Minitab worksheet columns. You should use:

Name C1 'Description' C2 'Known Sales' C3 'Warranty Claims as Percent of Known Sales'

Instead of

Description C1;
Known Sales C2;
Warranty Claims as Percent of Known Sales C3;

Also the next line in the macro has a syntax error

Chart 'Known Sales' * 'Warranty Claims as Percent of K';

It should be

Chart 'Known Sales' * 'Warranty Claims as Percent of Known Sales';


I am not sure that I would use a Global Macro but I don't see why it wouldn't work.

I am assuming that you need the names of the columns for your chart titles. So as you can see the more requirements that your final result has the more complicated the Minitab Macro has to become. You could have done the following if you didn't care about the titles:

Chart C2 * C3;

You should use Minitab Help and goto Session Commands. From my experience many people look at the Macro section when the Commands section is what they really need. If you look at the Session Commands in Alphabetical order this will be a good tool for future Minitab Macros. For example click on N and look for Name and it will give you all the syntax required to use the naming of columns code.

If you are going create many more Minitab Macros you should probably upgrade to version 15 since you can no longer get support on version 14. Minitab Technical Support Specialist are the best in the business and as long as you are on current version their support is included in the purchase price of the software/upgrade.


Happy New Year

Jay Bronec

PS I am interested in why this macro is so important what is the business problem you are trying to solve that requires you to create this macro.





 
M

Minitab_Novoice

Hi SPCGeek2
Thanks a lot for the quick response :)
First of all let me answer your question why this macro is so important
actually i work for some other tool, C#.NET and i normally generate all the graphs throght C#.NET itself but then this time the requirement is more complex and it requires some statistical analysis and more over i have purchased MINITAB 14 long ago for some other requirement. So thought of generating the graphs through a macro in minitab and saving it in a folder where my application can access it. and about the update to MINITAB 15 right now frankly speaking i cannot afford it.

I would request you to please extend your support as i am completely new to this ,i have never used MINITAB before but am sure i would like to work on it now.

could you please look at the following code , i made all the changes you have told and the grph was working fine for one column but then my requirement is like there should be two Y axis (columns) ,
one would be 'Warranty Claims as Percent of Known Sales'
and other one would be a function for 'count of Known sales '
and the X axis would involve the text colums Description. Please let me know what is going wrong here


GMACRO
STARTUP
ECHO
read C1-C3;
file "E:\Weibull\MINITAB.14 on hst-pcs-19475\Macros\abc.txt";
TAB.
Name C1 'Description'
Name C2 'Known Sales'
Name C3 'Warranty Claims as Percent of Known Sales'
Chart ('Known Sales') * 'Description';
Summarized.
DatLab 'Warranty Claims as Percent of Known Sales'
BAR.
ENDMACRO

Please look at the attachment i have attached the graph which i got from my colleague and this is how i need to generate a graph in Minitab , but then i am not able to get both that bar graph and the line chart in the same graph so i thought i would generate a bar graph and try to label the third column values on these bars. Please let me know if a graph like the one attached is possible in Minitab

Thanks once again for helping me out !!
 

Attachments

  • existing_Graph.GIF
    existing_Graph.GIF
    37.4 KB · Views: 202
M

Minitab_Novoice

Hey Jay forgot to wish you
Hope you have a great new year ahead.

Regards,
Madhu
 
S

SPCGeek2

Madhu:

I am afraid I am not going to be much help since this is no longer a Minitab automation problem but really "how to duplicate the graph from your colleague" problem. I took a quick look at the graph from your colleague and it seems that the graph was made in Excel. I am struggling to see why this problem requires an advanced statistical software program. Why not figure out how your colleague created the graph in Excel and create an Excel macro. I would imagine that you could even integrate the output from Excel directly to your C*.net application through some VB code.

As a solution provider, I can't be limited by how the problem can be solved. Sometimes the problem requires Minitab and/or GainSeeker but sometimes the problem requires whatever software program is available. I am reminded of one of my favorite quotes by Albert Einstein..."The best models are as simple as possible. But not simpler." I think you have the opposite problem as most people I run into; they have a very complex problem and they force a simple solution however I believe you have a very simple problem and you are trying to solve it with a more complex solution then is needed.

Also since you don't have the resources needed to upgrade your Minitab software, I think it is a little risky to develop solutions in unsupported software.
 
Last edited by a moderator:
Top Bottom