BookmarkSubscribeRSS Feed
jmanning29
Calcite | Level 5
I am new to SAS. Would someone help me with this error?
 
 
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 proc print data=/** Import an XLSX file. **/
74
75 PROC IMPORT DATAFILE="/folders/myfolders/U2_A1FBStockPrice.xlsx"
______
22
76
ERROR 22-322: Syntax error, expecting one of the following: ;, (, BLANKLINE, CONTENTS, DATA, DOUBLE, GRANDTOTAL_LABEL,
GRANDTOT_LABEL, GRAND_LABEL, GTOTAL_LABEL, GTOT_LABEL, HEADING, LABEL, N, NOOBS, NOSUMLABEL, OBS, ROUND, ROWS, SPLIT,
STYLE, SUMLABEL, UNIFORM, WIDTH.
ERROR 76-322: Syntax error, statement will be ignored.
76 OUT=WORK.FB_StockPrice
77 DBMS=XLSX
78 REPLACE;
79 RUN;
 
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
 
80
81 /** Print the results. **/
82
 
 
83 PROC PRINT DATA=WORK.B_StockPrice; RUN;
ERROR: File WORK.B_STOCKPRICE.DATA does not exist.
 
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
 
84
85 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
97
 

 

3 REPLIES 3
SASKiwi
PROC Star

This is the cause of your problem. You've partly commented a line and what is left isn't a valid SAS statement.

proc print data=/** Import an XLSX file. **/

Either remove the line entirely or change it so the whole line is a comment:

/** proc print data= Import an XLSX file. **/
ballardw
Super User

It helps to post log results or code into code box opened on the forum using the {I} icon to preserve formatting.

Such as:

14   proc print data=/** Import an XLSX file. **/
15
16   PROC IMPORT DATAFILE="/folders/myfolders/U2_A1FBStockPrice.xlsx"
          ------
          22
          76
ERROR 22-322: Syntax error, expecting one of the following: ;, (, BLANKLINE, CONTENTS, DATA,
              DOUBLE, GRANDTOTAL_LABEL, GRANDTOT_LABEL, GRAND_LABEL, GTOTAL_LABEL, GTOT_LABEL,
              HEADING, LABEL, N, NOOBS, NOSUMLABEL, OBS, ROUND, ROWS, SPLIT, STYLE, SUMLABEL,
              UNIFORM, WIDTH.
ERROR 76-322: Syntax error, statement will be ignored.
17      OUT=WORK.FB_StockPrice
18      DBMS=XLSX
19      REPLACE;
20   RUN;

Now it is possible to see that the diagnostics indicate the proximate error is the word IMPORT. Which is not an option for PROC PRINT which is what the "expected" elements are: Proc Print options. The code was attempting to Print the dataset Proc due to the reasons pointed out by @SASKiwi .

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1525 views
  • 1 like
  • 3 in conversation