LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (August 2009, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 13 Aug 2009 10:08:26 -0400
Reply-To:   Abdallah abouihia <abouihia@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Abdallah abouihia <abouihia@GMAIL.COM>
Subject:   datasets in use by you in resource environment DMS Process

Dear All,

I'm using the following macro to export sas file to excel (see below), the macro works perfect, however the SAS datasets I export still in use internally, even though I close it using:

( %let dsid=%sysfunc(close(&dsid))

I got the following message :

ERROR: You cannot open WORK._DSFU04.DATA for output access with member-level control because WORK._DSFU04.DATA is in use by you in resource environment DMS Process.

and I have to close the sas session to be able to access my SAS datasets.

Could someone, review and correct my below macro

Many thanks and best regards

Abdallah

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

%macro send2excel( delim='09'x, /* DELIMITER TO USE - SPECIFY EMPTY FOR NONE */ dsn=, /* REQUIRED: NAME OF SAS DATA SET */ exloc=, /* REQUIRE: Full excel location instead of the next 4 vars */ sheet=, /* REQUIRED: DESTINATION EXCEL SHEET - MUST EXIST! */ cells=, /* REQUIRED: DESTINATION ROW AND COLUMNS */ cond=, /* OPTIONAL: A DATA SET SUBSETTING CONDITION */ tab_opt=notab /* OPTIONAL: OPTION FOR THE FILENAME STATEMENT */ );

%let dsid=%sysfunc(open(&dsn));

%let var_n_delim=; %do i=1 %to %sysfunc(min(265,%sysfunc(attrn(&dsid,nvars)))); %let var_n_delim = &var_n_delim %sysfunc(varname(&dsid,&i)) &delim; %end;

%let dsid=%sysfunc(close(&dsid));

filename _xl_ dde "&exloc" &tab_opt lrecl=32767; data _null_;

set &dsn; &cond; file _xl_; put &var_n_delim; run;

filename _xl_ clear; %mend;


Back to: Top of message | Previous page | Main SAS-L page