Dear Experts,
I've 2 datasets for regression testing (against each other). It's a very rare (almost never happens) that there is a discrepancy between two datasets. So, i'm providing a portion of data that would be identical for both datasets.
The code produces a PDF report from PROC GLM and PROC PRINT outputs. When running it without PROC GLM, there is no issue. But with PROC GLM I'm getting an error message "ERROR 180-322: Statement is not valid or it is used out of proper order." in the log. Looking at the log, I would say the error is caused by ODS GRAPHICS ON /PROC GLM statement.
I've read previous posts ( example ) regarding this error message and investigated my codes, but no success. May be somebody did have a similar experience as me and could help to figure out the issue.
Below is data portion, my code and log screens.
Thank you!
data have_old;
input P Est SE Grad;
cards;
1 -3.27 0.46 0.00
2 -3.46 0.49 0.00
3 -5.60 1.44 0.00
4 -1.25 0.15 0.00
5 -0.83 0.14 0.00
6 -4.68 0.75 0.00
7 -3.56 0.44 0.00
8 -0.22 0.22 0.00
9 -1.51 0.33 0.00
10 -3.50 0.38 0.00
11 -2.67 0.25 0.00
12 -1.93 0.33 0.00
13 -4.14 0.53 0.00
14 -3.04 0.55 0.00
15 -3.41 0.43 0.00
16 -2.19 0.34 0.00
17 -3.08 0.32 0.00
18 -1.95 0.19 0.00
19 -3.76 0.40 0.00
20 -4.31 0.71 0.00
;
run;
data have_new;
set have_old;
run;
%macro compare; ods noproctitle; ods pdf file= "C:\Users\myfolder\Desktop\test\output\DOC1.pdf"; %do i= 1 %to 1; data newversion; set n&i._%fixname(%scan(&&newversionfile&i, 1, -)) (keep= p est); run; data oldversion; set o&i._%fixname(%scan(&&oldversionfile&i, 1, -)) (keep= p est); run; data combined; merge newversion(rename=(est= Version_%fixname(&newversion))) oldversion(rename=(est= Version_%fixname(&oldversion))); by p; if Version_%fixname(&newversion) ne Version_%fixname(&oldversion) then Warnings= "Check this row for discrepancies"; run;ods graphics on; ods exclude all; ods select FitStatistics FitPlot; PROC GLM data=combined plots= all; model Version_%fixname(&newversion) = Version_%fixname(&oldversion); title "Regression Testing of &NewVersion and &OldVersion EST values: %upcase(&&newversionfile&i)"; footnote j=l font=arial h=8pt "Source:&&newversionpath&i\&&newversionfile&i and &&oldversionpath&i\&&oldversionfile&i"; run; quit; ods graphics off; title "Discrepancies between &NewVersion and &OldVersion EST values: %upcase(&&newversionfile&i)"; footnote j=l font=arial h=8pt "Source:&&newversionpath&i\&&newversionfile&i and &&oldversionpath&i\&&oldversionfile&i"; proc print data=combined noobs; where Warnings ne ""; run; title;footnote; %end; ods pdf close; ods html; ods proctitle; %mend; %compare;
Log without PROC GLM (only proc print, where subsetting statement excluded for testing)
Log with PROC GLM
Hello @A_Kh,
An invalid non-printable character, e.g. 'A0'x (non-breaking space), after "ods graphics on;" can cause exactly this error message. So, deleting all whitespace characters between "ods graphics on;" and "ods exclude all;" and replacing them with ordinary blanks might resolve the issue.
Hello @A_Kh,
An invalid non-printable character, e.g. 'A0'x (non-breaking space), after "ods graphics on;" can cause exactly this error message. So, deleting all whitespace characters between "ods graphics on;" and "ods exclude all;" and replacing them with ordinary blanks might resolve the issue.
Hi @FreelanceReinh ,
Thank you for your reply! Yes, apparently that was the issue. I've removed every single blanks around proc glm and it cleared the log from error.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.