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.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

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!

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
  • 713 views
  • 0 likes
  • 2 in conversation