Desktop productivity for business analysts and programmers

Delete data set icon from project without deleting data?

Reply
Occasional Contributor
Posts: 9

Delete data set icon from project without deleting data?

Is it possible to delete the data set icon found in a project without deleting the data actually on the server? I would like to be able to have a data set be created in macro code but not have the data set show up on the process flow.

Thanks,

Mark

Contributor
Posts: 45

Re: Delete data set icon from project without deleting data?

Hi Mark,

I have hit this problem too and I do not think that there is a suitable way around this unfortunately.

If you use proc append or proc sql insert into to append to a dataset that already exists then it often does not show up in the process flow however when you create a new dataset it does always show up.

I think that if you run a stored process to create a dataset in a library that you have not already registered in your project then it doesn't show up but I can't be sure.

Tim

Contributor
Posts: 45

Re: Delete data set icon from project without deleting data?

Hi Again Mark,

I had a bit of a breakthrough with this so thought I would share.

When an enterprise guide program finishes it will add an icon for any datasets that have been edited to the process flow only as long as the libname is still assigned.

This means that if your macro writes data to a table and then clears the libname then that table won't be added to the process flow.

For my processes I had one program that wrote data to a new work table which I displayed to the user using proc report and then a separate program needed to pick up the generated table for further processing after the user had looked at the results screen. This hit several issues in that the work table was always added to the process flow since I couldn't unassign WORK meaning that the user could hack into and change the values in the table with no audit track of what was happening.

Since I didn't want to have to keep checking created/edited timestamps on tables the workaround i put in was in the form of the following macro.

This macro will create a new directory within in your saswork location assigned as _work. calling %m_sys_hiddenwork(assign) at the start of your program and %m_sys_hiddenwork(clear) at the end will give you a library that you can write data to that will not be visible from within you EG project but is available to any program that runs the macro. Added bonus is that when your session ends these temporary tables get cleaned up along with the rest of you SAS work data.

/* ---------------------------------------------------------------------------

Program : m_sys_hiddenwork.sas

Created by: Tim Campbell

Created on: 03-Oct-2013

Purpose :   Create a temporary library within the current sas work directory so

            that temporary tables can be created in a way that does not cause

            them to show up in enterprise guide.

Output :    libname to new directory assigned or cleared based on parameter inputs.

Parameters :

NAME            DESCRIPTION                                    DEFAULT

--------------  ---------------------------------------------  --------

in_assign       Determines wheter the macro assigns or clears  none (Required)

                the libname reference.

in_dirname      directory to store data in                     temp (Optional)

in_libref       libref to use                                  _work (Optional)

Requirements:

Macro variable sasworklocation defined to be a path on the server that the

user has write access to.

Code assumes that sasworklocaion defined as per enterprise guide definition

i.e. enclosed in single quotes.

---------------------------------------------------------------------------- */

%macro m_sys_hiddenwork(in_assign,in_dirname=temp,in_libref=_work);

    /* check if sasworklocation macro variable exists */

    %if not %symexist(sasworklocation) %then %do;

        %put ERROR: sasworklocation macro variable not defined;

        %return;

    %end;

/* Assigning library */

    %if %upcase(&in_assign) = ASSIGN %then %do;

        data _null_;

            newdir=dequote(&sasworklocation)||"&in_dirname";

            /* attempt to create the directory */

            Dir_rc=dcreate("&in_dirname",&sasworklocation);

            if strip(Dir_rc) ne '' then do;

                line="/*** New Directory "||strip(newdir)||" has been created. ***/";

                putlog line;

            end;

            else do;

                line="/*** Directory "||strip(newdir)||" already exists. ***/";

                putlog line;

            end;

        /* assign filename to the directory and assign library */

            rc=filename('chkdir', newdir);

            if fexist('chkdir') then rc=libname("&in_libref", strip(newdir), 'base');

            rc=filename('chkdir');

        run;

    %end;

    /* clearing library */

    %else %if %upcase(&in_assign) = CLEAR %then %do;

        libname &in_libref clear;

    %end;

    %else %put ERROR: Unknown value for input parameter in_assign. Must be ASSIGN or CLEAR.;

%mend;

Trusted Advisor
Posts: 1,213

Re: Delete data set icon from project without deleting data?

Interesting approach.

In 9.3 (I think, maybe earlier) they added ability for libname statement to create a directory for you.  See system option DLCREATEDIR.  Could make your macro a bit shorter.

Also in EG, Tools->Options->Results you can set maximum number of datasets to be added to the project to be 0.

--Q.

Contributor
Posts: 45

Re: Delete data set icon from project without deleting data?

Hi Quentin,

Thanks for the tip on DLCREATEDIR. It cut the 'Assigning Library' part of the macro if statement down to just

    %let l_options=%sysfunc(getoption(dlcreatedir));

    options dlcreatedir;

    libname &in_libref base "%sysfunc(dequote(&sasworklocation))&in_dirname";

    options &l_options;

which looks much neater.

Although I may need to review this if I decide that dlcreatedir is something we want to block for EG users.

I did look at setting the EG options so that max number of datasets output was 0 however

    a) The option is machine specific not project specific so doesn't apply for other users.

    b) I might not want to surpress the datasets for every program in the project.

    c) Whenever datasets are created I get a 'Data Set Limit Reached' note added to the project instead so we're straight back to the original issue!

Tim

Frequent Learner
Posts: 1

Re: Delete data set icon from project without deleting data?

Thanks for the tip for changing the number of datasets added to the project. It's does exactly what I wanted - remove clutter from the project.  I've been using EG for many years now and never noticed this option.

Valued Guide
Posts: 3,206

Re: Delete data set icon from project without deleting data?

Use parallel processing as possible with Eg 5.1 and up. The parallel processing option is a code-node or task option.

It also available at project properties.

What will happen:

- running a code in parallel wil use an additional sas-session that will not update the session of your Eguide-view.

- an upper limit may be set as part of the EGuide configuration. Should get attention in the packaging steps for closed desktops.

Beware of the other way around of this behavior.

When needing information (macro-s libnames filenames) that should be propagated to next steps the parallel code execution is a bad choice as it will not communicate those thing back. For concepts: it is a approach looking like grid-processing.

Tim, why trying to blocking users from doing their work and not having to approach tos support/help them.

In a well defined environment you should have your OS controls in way the system is safe for normal use.

Having that done, your users can safely use that environment and there is no reason to push in a lot of SAS tricks in to block anything.

The DLCREATEDIR is a good one to have more sub-directories being defined at some predefined ones without all kind of other difficulties.

---->-- ja karman --<-----
Ask a Question
Discussion stats
  • 6 replies
  • 1781 views
  • 3 likes
  • 5 in conversation