Date: Tue, 3 Jul 2001 14:52:43 -0400
Reply-To: James Green <james.green@alcatel.com>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: James Green <james.green@ALCATEL.COM>
Organization: AlcaNET Canada
Subject: Re: Macro Help...SOLUTION
FYI- For those of you who may be interested... here is the solution;
1-Add an extra ' . ' into the output filename. ( &prod._debug.gif )
2-Place the proc pareto after the summary (and before %mend).
3-In my orginal file I had the dataset name in quotations ("&ndset") they
are not needed.
These changes produce the 5 pareto's and remove the error
WARNING: Apparent symbolic reference NDSET not resolved.
WARNING: Apparent symbolic reference PROD not resolved.
ERROR: File WORK.NDSET.DATA does not exist.
I confused myself with proc sql, where the value stays in memory until you
exit or replace with a newer value. ie.
proc sql noprint;
select max(def_cnt) into: max
from product;
quit;
data _null_;
put "&max";
run;
/* Here is the working code, again you may have to fix the input statement
to run /*
/*bogus data*/
data PRODUCT;
input @1 Product $12. @17 fault $4. @24 DEF_CNT 3. ;
cards;
1234 CR 1
1234 CB 4
1234 CN 2
1234 CG 1
1234 CN 2
1234 CG 1
1234 CD 1
4567 PLUS CB 1
4567 PLUS CD 3
4567 PLUS CF 1
4567 PLUS CG 1
4567 PLUS CF 3
4567 PLUS CF 3
4567 PLUS CF 3
ACCE SHELF CD 2
ACCE SHELF CD 2
ACCE SHELF CD 2
ACCE SHELF CR 1
ACCE SHELF CG 4
ACCE SHELF CD 1
ACCE SHELF CC 2
MINI SYSTEMS CC 1
MINI SYSTEMS CR 6
MINI SYSTEMS CF 1
MINI SYSTEMS CR 6
MINI SYSTEMS CF 1
MINI SYSTEMS CR 6
MINI SYSTEMS CF 1
MINI SYSTEMS CD 1
MINI SYSTEMS CD 1
MIPS CR 1
MIPS CM 2
MIPS CR 1
MIPS CM 2
MIPS CM 3
MIPS CG 4
MIPS CM 3
MIPS CG 4
MIPS CG 5
;
/* Create a DEBUG data set for each product*/
%macro debug(dset,prod,ndset);
proc summary data=&dset nway;
where product="&prod";
class product fault;
var DEF_CNT;
output out=&ndset(drop=_type_ _freq_)sum=DEF_CNT;
proc sort; by product; run;
/*Create a Fault Pareto for each product*/
filename gsasfile "&prod._dbg.gif";
goptions reset=all gunit=pct cback=white device=gif570
colors=(black)ftext=swiss htext=2 ctext=mob gaccess=gsasfile;
title height=2.5 font=swissb c=STEEL "&prod DEFECT BY FAULT TYPE";
proc pareto data=&ndset;
vbar fault / maxncat=10 freq=def_cnt scale=count other='Other'
nocurve last='Other' cbars=blue interbar=2 barlabel=value angle=-90;
run;
%mend;
%debug(product,1234,_1234)
%debug(product,4567 PLUS,_4567_PLUS)
%debug(product,ACCE SHELF,ACCE_SHELF)
%debug(product,MINI SYSTEMS,_MINI_SYSTEMS)
%debug(product,MIPS,_MIPS)
quit;