BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
dashj
Calcite | Level 5

 Hello,

 

I'm having an issue with the code below. No matter what I do I am always served with the Note from my title. SAS will not proceed until I click ok and clear the note.

 

A PROC is currently executing. All subsequently submitted statements will not begin executing until its completion.

 

Similar to this question:

https://communities.sas.com/t5/Base-SAS-Programming/How-to-suppress-this-pop-up-note/td-p/303459

 

I have options xsync; because I plan on using this in a loop where I create a file, password protect it, destroy the XML dynamically. I don't want SAS to hit the delete XML x command before it's completed the conversion. (This may be my problem).

 

/****************************/
/*DUMMY SAS DATA FOR EXAMPLE*/
/****************************/

data FINAL_DATA;
		set sashelp.cars;
		Keep Make Model Type;
		IF Make = 'BMW';
run;

proc sort data=FINAL_DATA;
	by Type;
run;

/*************/
/*CREATE FILE*/
/*************/

%macro CreateFile;
		ods tagsets.excelxp file="C:\my_folder\XML_FILE.xml" style=listing;

		proc print data=FINAL_DATA noobs;
			by Type;
		run;

		ods tagsets.excelxp close;

%mend CreateFile; 


/**************************************/
/*CONVERT TO XLSX AND PASSWORD PROTECT*/
/**************************************/

%macro ProtectFile;
		%let FinalFile = C:\my_folder\OUTPUT.xlsx; 
		%let password=test;      
		%let XMLfile = C:\my_folder\XML_FILE.xml;                              
		%let VBscript  = C:\another_folder\convert.vbs; 
		                                                                                                                                        
		data _null_;                                                                                                                            
		   file "&vbscript" lrecl=200;                                                                                                            
		   put 'Dim xlApp, xlWkb, SourceFile, TargetFile';                                                                                         
		   put 'Set xlApp = CreateObject("excel.application")';                                                                                    
		   put 'SourceFile="' "&XMLfile" '"';                                                                                                      
		   put 'Set xlWkb = xlApp.Workbooks.Open(SourceFile)';                                                                                     
		   put 'TargetFile="' "&FinalFile" '"';                                                                                                    
		                                                                                                                                        
		   put 'xlApp.DisplayAlerts=false';                                                                                                        
		   put "xlWkb.SaveAs TargetFile, 51,""&password""";                                                                                          
		   put 'xlApp.DisplayAlerts=true';                                                                                                         
		   put 'xlWkb.close';                                                                                                                      
		run;                                                                                                                                    
		                                                                                                                                        
		options noxwait xsync;                                                                                                                
		                                                                                                                                        
		x "cscript ""&vbscript""";   

		x "del C:\my_folder\XML_FILE.xml";
%mend ProtectFile;

%CreateFile;

%ProtectFile;

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

1) Turn on options mprint before executing the code.

2) Paste the log with the generated code and messages into a codebox.

 

As it is there could be multiple places you message is originating and we can't tell where.

 

If you place all of the commands in a single command line they should execute sequentially without SAS intervention. Write all of the statements to CMD or BAT or appropriate and then have the X command execute that command file.

View solution in original post

1 REPLY 1
ballardw
Super User

1) Turn on options mprint before executing the code.

2) Paste the log with the generated code and messages into a codebox.

 

As it is there could be multiple places you message is originating and we can't tell where.

 

If you place all of the commands in a single command line they should execute sequentially without SAS intervention. Write all of the statements to CMD or BAT or appropriate and then have the X command execute that command file.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 1 reply
  • 1968 views
  • 0 likes
  • 2 in conversation