BookmarkSubscribeRSS Feed
SASdevAnneMarie
Barite | Level 11

Hello Experts,

 

I'm working on SAS Guide 8.3. I have the error because the data remains open (in yellow)  after the code execution. There are some options please to close the data, please ? Thank you !

MarieT_0-1642080111380.png

%macro cleartemplib(libtofree);
	%if %sysfunc(libname(&libtofree)) ne 0 %then
		%put NOTE: Libref &libtofree could not be unassigned;
	%else %put NOTE: Libref &libtofree has been unassigned;
%mend;


%macro Affectation (libref= , metaLibName= );
	
	%cleartemplib(&libref);


	libname &libref meta library="&metaLibName";
%mend Affectation;

%Affectation(libref= PSAEU11, metaLibName= PEGASE - PSAEU11);

%let Rep_Travail			= \\lamondiale.com\LMPAPROD\USINE_PRIIPS\;
%let EntreesManuelles  		= &Rep_Travail.2. DONNES INPUT\2.1 DONNEES MANUELLES;
%let EntreesManuellesBis	= &Rep_Travail.\5. RETRAITEMENTS MANUELS\Chaine Produits;
%let EntreesPDFemtn			= &Rep_Travail.2. DONNES INPUT\2.2 PDF EMTN;
%let Sorties 				= &Rep_Travail.4. DONNEES OUTPUT;
%let Publications			= &Rep_Travail.6. PUBLICATIONS\6.1 DICTIONNAIRES DE DONNEES;
%let ArchivesPublications	= &Rep_Travail.6. PUBLICATIONS\6.1 ARCHIVES PUBLICATIONS;
%let SortiesPDFemtn			= &Rep_Travail.6. PUBLICATIONS\6.2 PDF EMTN;
%let SortiesFicemtn			= &Rep_Travail.6. PUBLICATIONS\6.4 FICHIERS_EMTN;


Data _null_;
	DateInitiale='01JAN2018:00:00:00'dt;
	Call symputx('DateInitiale',DateInitiale);
	DatePublication=today();
	Call symputx('DatePublication',DatePublication);
run;


Data _null_;
	YYYY=year(&DatePublication);

	if month(&DatePublication) < 10 then
		MM=compress(("0"!!month(&DatePublication)));
	else MM=month(&DatePublication);

	if day(&DatePublication) < 10 then
		DD=compress(("0"!!day(&DatePublication)));
	else DD=day(&DatePublication);
	DatePubli=compress(YYYY!!MM!!DD);
	Call symputx('DatePubli',DatePubli);
run;

%put  &DatePubli;


proc import 
	datafile= "&EntreesManuellesBis\xxxxxx"
	out=PRODUITS_PRIIPS
	replace dbms=xlsx;
	getnames=yes;
	range="SAS_IMPORT";
run;


proc import 
	datafile= "&EntreesManuelles\xxxx"
	out=EMTN_EXCLUS
	replace dbms=xlsx;
	getnames=yes;
run;  

 

3 REPLIES 3
JosvanderVelden
SAS Super FREQ
How are you terminating the data creation code?
If you are using proc sql you probably should end with quit;
Can you provide the code?

Best regards, Jos
SASdevAnneMarie
Barite | Level 11
Hello,

Thank you, I added the code to my main message. The table PRODUITS_PRIIPS remains open.
JosvanderVelden
SAS Super FREQ
Hi Marie,
Were you able to solve this?
The code you provide is not enough to be able to help in solving.
Do you have an active libref to the xlsx-file?
If yes then you need to clear that libref so that the xlsx-file is released.

Best regards, Jos

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 3 replies
  • 635 views
  • 1 like
  • 2 in conversation