BookmarkSubscribeRSS Feed
Kurt_Bremser
Super User

@mhoward2 wrote:
Ah interesting, I have no idea how Unix and windows interact. So the files would have to be a share drive that within Unix? Also then how does the import wizard pull in this file no problem?

Thanks again!

The import wizard in Enterprise Guide uses your local Windows to read the file, transfers the content via the IOM bridge to the SAS workspace server process's WORK, and sends code to import the file from there. If you want to read the file without the EG interaction (i.e. you want to run the code in batch), the file needs to be accessible from the UNIX filesystem of the server.

ballardw
Super User

Please not that the error has a different path then that in your code.

It is best to copy the code from the log along with errors and paste all of that into a code box. That way we see the entire code as actually submitted.

 

Is the //w3r2 supposed to indicate a network server on your network? If not that might be the issue as it may be treated that way.

And if that is intended are you working with a SAS server set up? The server might be using different permissions than yours attempting to access the file.

 

And there may not be a need for a macro at all as you can read multiple text files with a single data step, if that would be preferred instead of reading into 12 data sets.  Since I don't see anything on your INFILE like FIRSTOBS where you are skipping header rows this would be fairly easy with a long FILENAME statement.

mhoward2
Obsidian | Level 7
The reason the share drive address dont match up is me messing up which copy and paste it should be, thanks for catching that. The correct address is the error.

How do I read multiple in a single step if I cant even read in one? haha I appreciate any and all advice!
ballardw
Super User

When you get the path issue straightened out you might try your Infile to use \test*.txt IF all of the Test files in the folder have the same layout. The wildcard * would get all the files in the folder whose names start with "Test".

Or for specific files only, such as you want to read 1 to 12 of 100 files a filename similar to this:

Filename toread ("<path>\test1.txt" "<path>\test2.txt" "<path>\test31.txt") <other filename options>;

and use: Infile Toread <remaining Infile options>;

 

If you want to know which file each record came from then you can investigate the mysteries of saving the value of a Filename=<some variable name> option on the Infile statement. Not hard, routine and tedious, to have the file.

mhoward2
Obsidian | Level 7
All the files are basically identical in format. Just different values. The filename thing isnt the issue since its the correct file name in the program. SAS still cannot read in the file though, exact same error.

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
  • 19 replies
  • 1300 views
  • 3 likes
  • 5 in conversation