BookmarkSubscribeRSS Feed
4301
Calcite | Level 5

%MACRO excel (OUTPUT=,INFILE=,WSHEET=);
PROC import OUT= &OUTPUT
DATAFILE="P:\FALL COURSES 2020\SAS\final project\&INFILE"
DBMS=xls;
SHEET="&WSHEET";
PROC CONTENTS DATA=&OUTPUT;
PROC SORT DATA=&OUTPUT;
BY ID;
RUN;
%MEND excel;
%excel(OUTPUT=Site1,INFILE=Site1.XLS,WSHEET=SHEET1);
%excel(OUTPUT=Site2,INFILE=Site2.XLS,WSHEET=SHEET1);

 

ERROR: File WORK.SITE2.DATA does not exist.

1 REPLY 1
Kurt_Bremser
Super User

The last ERROR is always the least important. The first ERROR or WARNING is most important.

And before you start making code dynamic, make sure that it works.

Run your import code without any macro variables, and post the complete log of the step if it fails. Use a window opened with </> to post the log.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

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
  • 1 reply
  • 781 views
  • 0 likes
  • 2 in conversation