Hello:
I have infile codes below and I got error message from log. Please help. Thanks.
options mprint symbolgen mlogic;
libname MedSCN "\\abc.org\PROJECTS\MedScreen\SAS";
%let Sheetname=ScreenClass;
Filename "\\abc.org\PROJECTS\MedScreen\SAS\&sheetname..csv";
data medscn.&sheetname;
infile filename MISSOVER DSD firstobs=2;
input
Group $
Analysis Group $200.
Class Label $300.
run;
230 %let Sheetname=ScreenClass;
SYMBOLGEN: Macro variable SHEETNAME resolves to ScreenClass
231 Filename
231! "\\abc.org\PROJECTS\MedScreen\SAS\&sheetname..csv\&sheetna
231! me..csv";
ERROR: Invalid logical name.
ERROR: Error in the FILENAME statement.
232
SYMBOLGEN: Macro variable SHEETNAME resolves to ScreenClass
233 data medscn.&sheetname;
234 infile filename MISSOVER DSD firstobs=2;
235 input
236 Group $
237 Analysis Group $200.
239 Class Label $300.
264 run;
ERROR: No logical assign for filename FILENAME.
This is invalid:
Filename "\\abc.org\PROJECTS\MedScreen\SAS\&sheetname..csv";
You have to supply a logical name for the file reference:
filename in "\\abc.org\PROJECTS\MedScreen\SAS\&sheetname..csv";
And then you use that in the import code:
data medscn.&sheetname;
infile ine MISSOVER DSD firstobs=2;
input
Group $
Analysis Group $200.
Class Label $300.
;
run;
PS your import code misses a semicolon and would therefore input a variable called run.
This is invalid:
Filename "\\abc.org\PROJECTS\MedScreen\SAS\&sheetname..csv";
You have to supply a logical name for the file reference:
filename in "\\abc.org\PROJECTS\MedScreen\SAS\&sheetname..csv";
And then you use that in the import code:
data medscn.&sheetname;
infile ine MISSOVER DSD firstobs=2;
input
Group $
Analysis Group $200.
Class Label $300.
;
run;
PS your import code misses a semicolon and would therefore input a variable called run.
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 save with the early bird rate—just $795!
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.