SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
gaylebrekke
Fluorite | Level 6

I'm trying to read in text files but there's a space in the directory name.  The examples I can find are too complicated - I'm not building a repeatable process, just trying to bring in my data (I don't think I need a pipe, for example).  Any suggestions?

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

CTRL+SHIFT+Right click on file-> Copy as Path

 

You can do that to get a full file path for a file in Windows, including double quotes.

View solution in original post

4 REPLIES 4
Reeza
Super User

How are you trying to read it in? Usually that's not an issue at all for SAS procedures. 

It would help if you post the code.

 


@gaylebrekke wrote:

I'm trying to read in text files but there's a space in the directory name.  The examples I can find are too complicated - I'm not building a repeatable process, just trying to bring in my data (I don't think I need a pipe, for example).  Any suggestions?


 

ballardw
Super User

If you are using Proc import then typing the name with the spaces should suffice:

proc import datafile="c:\some folder\another dir\my datafile.text"
<rest of proc>

or similar for an INFILE statement in a data step or even associating a FILENAME.

 

 

If you are using Windows Explorer (or possibly similar in other programs" to examine you files then:

1) navigate to the folder where the file exists

2) click in the address bar at the top with the folder path after the last entry,

3) the address bar text should now look a bit different and you can copy the text of the path and

4) paste the path into the quotes you use for the filename, infile or datafile.

Then add the file name with extension after a \.

Reeza
Super User

CTRL+SHIFT+Right click on file-> Copy as Path

 

You can do that to get a full file path for a file in Windows, including double quotes.

gaylebrekke
Fluorite | Level 6
Thanks so much! I thought I had tried everything, but I must not have tried that. Or maybe there's some sort of dark magic at work here. 🙂

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 4 replies
  • 11457 views
  • 2 likes
  • 3 in conversation