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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 864 views
  • 1 like
  • 2 in conversation