This is the macro code:
%macro rept_plot3xxx_8451_lo(num);
title "Lift scatter plot";
ODS pdf file="/trnapp/sas/qa/warehouse/playpens/{User Directory}/";
proc sgplot data=DWM_MIN_LIST_3XXX_T4T_SHORT;
where VEHICLE_NO = "&num"
and DWM_TRUCK_1_PRESS_2_FDBK_8451 between -2 and 25
and fault_code not in ('20-2093', '20-2094', '20-2095',
'20-2096', '20-2021')
;
yaxis label= "DWM_TRUCK_1_PRESS_2_FDBK_8451 psi";
scatter x=OCCUR_DATE y=DWM_TRUCK_1_PRESS_2_FDBK_8451;
xaxis grid;
yaxis grid;
run;
%mend rept_plot3xxx_8451_lo;
Calling the macro:
data _null_;
array veh_no[39] _temporary_ (3725:3763)
;
call execute('proc sql;');
do i=1 to dim(veh_no) while (veh_no(i) ne .);
call execute(cats('%nrstr(%rept_plot3xxx_8451_lo)(',veh_no(i),')'));
end;
call execute('quit;');
run;
I am getting the following errors in the log file:
WARNING: GPATH or PATH is not a writable directory. It will be ignored.
ERROR: Cannot write image to /trnapp/sas/common/biconfig/qgrid/Lev1/SASApp/SGPlot.png. Please ensure that proper disk permissions
are set.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were n observations read from the data set WORK.DWM_MIN_LIST_3XXX_T4T_SHORT.
WHERE (VEHICLE_NO='3725') and (DWM_TRUCK_1_PRESS_2_FDBK_8451>=-2 and DWM_TRUCK_1_PRESS_2_FDBK_8451<=25) and fault_code not in
('20-2021', '20-2093', '20-2094', '20-2095', '20-2096');
ERROR: SAS ended due to errors.
You specified: OPTIONS ERRORABEND;.
ERROR: Invalid file, /trnapp/sas/qa/warehouse/playpens/{User Directory"}.
ERROR: Errors printed on pages 1,2,10.
How will I resolve this error? I want to generate the plot in PDF format in the mentioned directory which is given in the macro code but it is somewhat trying to save in /trnapp/sas/common/biconfig/qgrid/Lev1/SASApp/ as .png format which I don't want and also giving an error.
Replace {User Directory} with the name of an existing sub-directory without using spaces and curly brackets in the name.
Make sure you have write access to that directory.
Also, try closing other ODS destinations. Run:
ods _all_ close;
before your code.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.