BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ybz12003
Rhodochrosite | Level 12

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.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

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.

View solution in original post

1 REPLY 1
Kurt_Bremser
Super User

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.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 1122 views
  • 1 like
  • 2 in conversation