BookmarkSubscribeRSS Feed
snoopy369
Barite | Level 11

Hi,

I'm training some new SAS Studio users who're going to be using our new Studio interface with a centralized (windows) server.

 

One thing I'm teaching them is how to export a file, say with PROC EXPORT.  While we can use the interface to do that, I also want to teach them how to do it with code.

 

How can they export to a file in a folder location that's defined in the server files and folders (by creating a folder shortcut), without specifying the fully qualified path?  This is fairly easy to do on _import_, because you simply create a file reference from the interface (select file, right-click, Create -> File Shortcut) and ta-da, use that file reference in your code.  But I don't see a way to create a file reference in the interface to a folder, or to a not-yet-extant file.

 

Is there a way to do this?  Right now, the common location they export to is a relatively hard to type path that i'd rather them not have to type every time they export.  They love the instant fileref from point+click, but the lack of that on export is disappointing.

 

Thanks!

6 REPLIES 6
Reeza
Super User
I usually set up a macro variable with the path at the top of all my programs. Then my export becomes

filename = "&path.\Deliverables\Final V02.xlsx"

Probably not quite what you're looking for but one option. The other is that you can use the .\ and ..\ but it does depend a bit on where the defaults are set, it may not go to where they want.
snoopy369
Barite | Level 11
No, i'm looking for a Studio specific option, but thanks for replying. And unfortunately at the moment '.' is a pretty lousy location on the server, we're going to see about changing that... but either way not going to be useful for this. But thanks again!
ballardw
Super User

@snoopy369 wrote:

Hi,

I'm training some new SAS Studio users who're going to be using our new Studio interface with a centralized (windows) server.

 

One thing I'm teaching them is how to export a file, say with PROC EXPORT.  While we can use the interface to do that, I also want to teach them how to do it with code.

 

How can they export to a file in a folder location that's defined in the server files and folders (by creating a folder shortcut), without specifying the fully qualified path?  This is fairly easy to do on _import_, because you simply create a file reference from the interface (select file, right-click, Create -> File Shortcut) and ta-da, use that file reference in your code.  But I don't see a way to create a file reference in the interface to a folder, or to a not-yet-extant file.

 

Is there a way to do this?  Right now, the common location they export to is a relatively hard to type path that i'd rather them not have to type every time they export.  They love the instant fileref from point+click, but the lack of that on export is disappointing.

 

Thanks!


Depending on your environment this may not even be possible. If a server is executing the code then the server would have to have a location mapped that it can address. Typically the servers do not address user PC locations at all. Each server set up varies. Without knowing a bit, or possibly a lot more, about your set up specific suggestions are kind of "shot in the dark" answers.

 

Personally I have seen too many issues related to overwritten or lost files from not using a fully qualified path for any file writing.

snoopy369
Barite | Level 11

I understand that, and the question isn't about local PC. This is about exporting a file to a location defined in the Server Files and Folders portion of SAS Studio, which can only include locations the server's able to access. Answering this shouldn't require knowing anything about our server, it (hopefully) should be a built-in SAS Studio feature (or, not, and will be a suggestion at some point).  Thanks for answering, though!

ballardw
Super User

@snoopy369 wrote:

I understand that, and the question isn't about local PC. This is about exporting a file to a location defined in the Server Files and Folders portion of SAS Studio, which can only include locations the server's able to access. Answering this shouldn't require knowing anything about our server, it (hopefully) should be a built-in SAS Studio feature (or, not, and will be a suggestion at some point).  Thanks for answering, though!


The only place by default that I would be sure that a users output can be written is the WORK library. After that it is your configuration settings. The problem with writing to WORK locations is the cleanup that occurs at the end of a session that would likely remove anything written. Your SAS Admin is the person to talk to as controlling or knowing what accesses may be available for users and how to create them.

 

 

snoopy369
Barite | Level 11

@ballardw I am one of the SAS Administrators at my site, and I don't think you understand the question.  It isn't a matter of where it is legal to export files.  It's a question about how to use the SAS Studio IDE's features to simplify my users' workflow, in particular with regards to file paths that are complex.  These folder paths will likely be pre-assigned on the administrative end, ultimately, and we know how to do that.

 

In SAS Studio, to import a file, you can use the IDE to create a file reference, and then type that file reference into your code.  

 

I'm looking to see if there's an equivalent way to do that for exporting a file, which I haven't found an equivalent solution for yet.

 

Thanks!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 6 replies
  • 1676 views
  • 0 likes
  • 3 in conversation