SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
seamoh
Obsidian | Level 7

Hello all the members, I hope you are very well.

I run the following program

</

title "Statistics from Sales Spreadsheet";
libname Read '/folders/myfolders/Dataset/Wages.xls';
proc means data=Read.'Permanent$' n mean;
var Wage Hours_Worked;
run;

/>

 

and here is the errors in the log:

</

OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 *6-3*;
74 title "Statistics from Sales Spreadsheet";
75 libname Read '/folders/myfolders/Dataset/Wages.xls';
ERROR: Library READ is not in a valid format for access method RANDOM.
ERROR: Error in the LIBNAME statement.
76 /* proc means data='/folders/myfolders/Dataset/Wages'.'Permanent$'n mean; */
77 proc means data=Read.'Permanent$' n mean;
____________
22
200
ERROR: Invalid data set name Read..
ERROR 22-322: Syntax error, expecting one of the following: ;, (, ALPHA, CHARTYPE, CLASSDATA, CLM, COMPLETETYPES, CSS, CV, DATA,
DESCEND, DESCENDING, DESCENDTYPES, EXCLNPWGT, EXCLNPWGTS, EXCLUSIVE, FW, IDMIN, INCAS, KURTOSIS, LCLM, MAX, MAXDEC,
MEAN, MEDIAN, MIN, MISSING, MODE, N, NDEC, NMISS, NOLABELS, NONOBS, NOPRINT, NOTHREADS, NOTRAP, NWAY, ORDER, P1, P10,
P20, P25, P30, P40, P5, P50, P60, P70, P75, P80, P90, P95, P99, PCTLDEF, PRINT, PRINTALL, PRINTALLTYPES, PRINTIDS,
PRINTIDVARS, PROBT, Q1, Q3, QMARKERS, QMETHOD, QNTLDEF, QRANGE, RANGE, SKEWNESS, STACKODS, STACKODSOUTPUT, STDDEV,
STDERR, SUM, SUMSIZE, SUMWGT, T, THREADS, UCLM, USS, VAR, VARDEF.
ERROR 200-322: The symbol is not recognized and will be ignored.
78 var Wage Hours_Worked;
ERROR: No data set open to look up variables.
ERROR: No data set open to look up variables.
79 run;
 
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.10 seconds
cpu time 0.00 seconds
 
80
81 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
93

/>

Thank you very much,

Deeply appreciated.

I am looking forward to your answers.

 

2 REPLIES 2
Shmuel
Garnet | Level 18

Open file Wages.xls with excel and save it , if possible, as an xlsx  type,

then change the code to read the Wages.xlsx file and try.

 

Otherwise you need to assign FILENAME the the Wages.xls file with "excel" engine,

import it and only afterwards you can rub proc means on the sas dataset.

Tom
Super User Tom
Super User

There is no libname engine to read XLS format files.  There is one for XLSX files.  But even then you should get in the habit of telling the libname statement what engine to use when you don't want to use the normal base SAS engine, instead of forcing it to guess.

libname read xlsx '/folders/myfolders/Dataset/Wages.xlsx';

If you are forced to use the XLS file then you will need to use PROC IMPORT to get the data converted into a SAS dataset.

 

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 960 views
  • 0 likes
  • 3 in conversation