Desktop productivity for business analysts and programmers

Can you add a SAS dataset to a project - in code

Reply
Occasional Contributor
Posts: 8

Can you add a SAS dataset to a project - in code

I am a former PC SAS user, who is now limited to SAS EG on a server. I am accustomed to having SAS Explorer available to quickly access SAS files (browsing). Navigating the Server List to find a file, often having to Refresh the Library, then double-clicking to add it to the project is time consuming. Usually this is a source file I may want to browse.

It would help immensely if there was some code, perhaps undocumented, that would put a file on the project - just as if I had gone through the steps above.
For example, in the code below, if I could put the "mainlib.monthly_data" onto the project, I'd have the file immediately available if I wanted to browse it.


/* Insert code to put monthly_data file in the project */

data testing ;
set mainlib.monthly_data (keep=a b c d) ;

*** additional code ;
run;
Contributor Jay
Contributor
Posts: 24

Re: Can you add a SAS dataset to a project - in code

Quick test of this, using SAS on a PC in EG:

mainlib library was pre-asigned.

Executed your data step and the testing dataset was now in the EG project.

I think the key is the pre-assigment of the library, talk to your SAS server adminstrator this is easy to set up if not already.
Occasional Contributor
Posts: 8

Re: Can you add a SAS dataset to a project - in code

The mainlib would be pre-assigned and would be on the Server List. My question was not in reference to the output file (testing dataset), it was in reference to the source file - mainlib.monthly_data.

Also, I don't know the terminology, but there are 2 different ways a dataset appears in a project.
1. In the process flow - In my example, the output file would be in the project. If I resubmitted the same code, specifying a differently named output file, the 1st output file would no longer be in the project.
2. If I choose a file from the Server list and 'Add to Project', the file is permanently in the project, listed on left side - not in a process flow. The file is only removed from the project if I remove it manually.

In my original question, I was asking about Adding a file to a project in the 2nd manner - permanently.
Community Manager
Posts: 2,889

Re: Can you add a SAS dataset to a project - in code

Jim,

I think I understand your question, but I don't think there is a way from a command line to do it.

You can use File->Open->Data as a menu item, navigating from the keyboard, to avoid having to click around. (Key sequence Alt+F, O, D to get to the data dialog.)

Chris
Occasional Contributor
Posts: 8

Re: Can you add a SAS dataset to a project - in code

One correction:

*** from prior posting:
If I resubmitted the same code, specifying a differently named output file, the 1st output file would no longer be in the project.

**** ;

When I said that resubmitting the code would take the former output file off the project - that was because of my option "Replace without Prompting".
However, my question is really not concerning output files, it's a desire to put any file I want on the project using SAS code rather than manually finding it on the Server List and then double-clicking or right-clicking and choosing "Add to Project".
Ask a Question
Discussion stats
  • 4 replies
  • 679 views
  • 0 likes
  • 3 in conversation