Currently where I work we have SAS 9.2 Foundation with QC package, and we have 4 templates, or macro programs, that will run with each of our products. Which we have 40+ products. The problem is, we are the only branch in the company using SAS for our reports and it has been desired for use to do them in JMP. A typical SAS marco for what we currently have is
%macro Import(Filepath=) the excel file(s), usually two worksheets from one workbook. One for the data and one for specification limits
%macro USLtest(test=)
%macro LSLtest(test=)
%macro BothSLtest(test=)
ods rtf startpage=now columns=1;
data resultsdata;
set resultsdata;
tablevalue=1;
format tablevalue 8.;
run;
/* timeline */
data phases (keep=lot_count _Lot_ _PHASE_);
length _PHASE_ $7;
set resultsdata;
if mfg_date <= &startdate then _PHASE_='Prior';
else if mfg_date >= &startdate then _PHASE_='Current';
run;
data limits (rename=(underscore=_VAR_));
set limitsdata;
where translate(strip(_VAR_),'____',' ()/')="&test";
underscore=translate(strip(_VAR_),'____',' ()/');
drop _VAR_;
run;
data vref (keep=newvar _REF_ _REFLAB_ _CVREF_ rename=(newvar=_VAR_));
set limits;
where _VAR_="&test";
newvar=strip(_VAR_);
do i=1 to 2;
if i=1 then do;
_REF_=_LSL_;
_REFLAB_='LSL';
_CVREF_='red';
output;
end;
if i=2 then do;
_REF_=_USL_;
_REFLAB_='USL';
_CVREF_='red';
output;
end;
end;
drop _VAR_;
run;
/* run chart */
proc shewhart data=resultsdata;
irchart &test*lot_count='*' / nochart nochart2 vref=vref /*outtable=data1*/ outhistory=data1;
run;
data data2;
merge data1 phases;
by lot_count;
_VAR_=strip("&test");
run;
data charts;
merge data2 limits;
by _VAR_;
call symput('lsl',strip(_LSL_));
call symput('usl',strip(_USL_));
call symput('var',strip(_VAR_));
call symput('units',strip(Units));
run;
/* Individual Measrements Chart */
proc shewhart history=data2;
irchart &test*lot_count='*' / outlabel=(lot_count) /* remove range chart */ nochart2 vref=vref /* Capability index based on subgroup data */ ciindices /* Spec LImits */ lsl=&lsl usl=&usl
/* Reads timelines */ readphases=all /* Identifies Phases at top of chart */ phaselegend vreflabpos=2 zerostd tests=1 to 4 testlabel1=' ' testlabel2=' ' clipfactor=2 totpanels=1;
inset stddev cpklcl='Cpk 95% Lower' cpk='Cpk' cpkucl='Cpk 95% Upper';
label &var="&var (&units)";
run;
/* Histogram */
ods select histogram;
proc capability data=charts noprint;
spec lsl=&lsl usl=&usl;
var &var;
histogram &var / normal;
inset n='N'
pctlss='% < LSL' pctgtr='% > USL' cpklcl='Ppk 95% Lower' cpk='Ppk' cpkucl='Ppk 95% Upper' /
cfill = ywh
format = 6.2;
label &var="&var (&units)";
run;
data resultsdata;
set resultsdata;
tablevalue=3;
format tablevalue 8.;
run;
ods rtf columns=4;
proc report data=resultsdata nowindows;
column lot_count _lot_ &test;
define lot_count / 'Count' display style(column)=[cellwidth=.5in];
define _lot_ / display;
define mfg_date / display;
define &test / display;
run;
%macro USLtestwithsubgroups(test=)
%macro LSLtestwithsubgroups(test=)
%macro BothSLtestwithsubgroups(test=)
ect..
%macro Outputfilemacro(filepath=) inside of this macro is summarized by a general order of (ODS graphics on, ods rtf startpage, call the test macros such as %BothSLtest(test='pH'), ods graphics off, rtf close)
I call anywhere from 8-20 different test macros inside of the outputfilemacro, each displaying 2-4 charts per test depending on which test macro is used.
at the end of my program I have just a hand full of things to change.
%Import(filepath=file location)
%Outputfilemacro(filepath=file loaction, product information for titles and such)
An example of Macros that I run in the outputfilemacro would be:
%mend outputfilemacro
ods graphic options with outfilepath destination
%BothSLChart (startdate='01Apr2013'd, test=pH)
%BothSLMeansChart (startdate='01Apr2013'd, test=Extractable_Volume, firstvar=C1, lastvar=C5, samplesize=5, startlotcount=42)
%USLChart (startdate='01Apr2013'd, test=Water_Content)
%BothSLChart (startdate='01Apr2013'd, test=Assay__Alprostadil_)
%USLChart (startdate='01Apr2013'd, test=PGA1)
%USLChart (startdate='01Apr2013'd, test=PGB1)
%USLChart (startdate='01Apr2013'd, test=keto_PGE1)
%USLChart (startdate='01Apr2013'd, test=iso_PGE1)
%USLChart (startdate='01Apr2013'd, test=Total_Impurities)
%BothSLMeansChart (startdate='01Apr2013'd, test=Content_Uniformity, firstvar=CU1, lastvar=CU10, samplesize=10, startlotcount=42)
%USLChart (startdate='01Apr2013'd, test=AV)
%BothSLChart (startdate='01Apr2013'd, test=Assay__NaCl_)
ods closing statements
%mend outputfilemacro
%Outputfilemacro (filepath=2014\2014_Productname\SAS\code, productnumber=code, productname=name, startdate='12Jun2013'd, enddate='11Jun2014'd)
Highlight that macro, click submit, SAS does the rest.
Test is the variable name from my data set that is being tested and charted against specification limits. I have control charts with Capability estimates tested against the spec limits.
The charts display spec limits specific to each test, current and prior time phases depending on the dates I select, and capability indexes in the top left corner of the charts. Each time I run this for a different product, all I do is change the filepath name, copy and paste which test macros I want to run, and set the test= value in each of the SLChart macros that I desire to have. I can output all the charts I need about about 5-10 minutes for each product and product strength that I have. This particular program for a strength of a product will produce 26 or so charts with data printout specific to the test following the chart.
Question is, can I do something similar as this in JMP 10? If so, how do macros work in JMP?
I have a slight understanding of JMP JSL, but am brand new to it. Just trying to figure out how to make things as automated in JMP as they are in our SAS macros.
Message was edited by: Jeff Ollis