DATA Step, Macro, Functions and more

SCL - Opening and running SAS code within frame

New Contributor
Posts: 3

SCL - Opening and running SAS code within frame

Hi - Apologies if this isn't in the relevant forum or question not worded clearly as am my SAS knowledge is fairly basic:

I have a frame that runs a standard piece of code over any file I have created that has all the relevant variables on it. In practice, this means I run the .sas code to produce my factor file and then open the frame, type in the file's name and some dates and then hit run to kick off the SCL code in the frame.

What I'd like to do is to automate this so that within my frame, I can enter the location of the .sas code I wish to run, have the frame open that code and run it and when it has finished automatically move on to the rest of the SCL code that runs when I press run now.

At the moment, my ugly solution is to run the code in one SAS session, open the frame in a 2nd session with a line of code that sets it to wakeup at a defined time later in the morning.

I have found the following way of opening up a list of external files in the frame and getting that filename in the textbox but am stumped as to how I could have the SCL open the code saved at that location and run it within the frame. Anyone know if its possible and able to give any guidance?

* Initialize SCL Variables *;
*** Maximize the window ***;
call execcmd('ZOOM ON');
*** Populate text box with initial value ***;
txt_SasProg.text = "Click on the Choose Program button.";
* Select PC File to Submit *;
*** Open File Dialog box to choose program ***;
*** Set value of text box to selected file ***;
txt_SasProg.text = selfile;

Again, sorry if my explanation is confusing! Thanks in advance for reading and any help you can offer.

Cheers, Mike
Super Contributor
Posts: 359

Re: SCL - Opening and running SAS code within frame

I am working off a 6 year old memory here, but you can load it into the preview buffer and submit that. You can tell the frame to wait or not. I would have to look up some old code to tell you more, but that should give you the startng point top find references.
New Contributor
Posts: 3

Re: SCL - Opening and running SAS code within frame

Hi Flip - Thanks a lot for the reply. I'll do some more digging around your suggestion and let you know if I can figure it out.

Cheers, Mike
Super Contributor
Posts: 474

Re: SCL - Opening and running SAS code within frame

Not sure about your trouble but, have you tried the submit continue statement?

You could load the path/file name of the code you want to submit into a macro var then issue the include command from within a submit/endsubmit block specifying CONTINUE option, which will suspends program execution while the submit block executes and then continues program execution at the statement that immediately follows the ENDSUBMIT statement.

/* whatever you need to do here */

Hope it helps.

Cheers from Portugal

Daniel Santos @
New Contributor
Posts: 3

Re: SCL - Opening and running SAS code within frame

Posted in reply to DanielSantos
Thanks Daniel,

At the moment I have settled on a less elegant solution where I have added a text box into my frame and asked the other users to make the relevant piece of code a SAS Macro. If they then enter the macro name into the textbox the SCL runs the content of the macro before moving on to the rest of the standard code that sits behind the frame.....

Sure its not the most efficient solution but it seems to work!

Thanks for taking the time to reply.
Occasional Contributor
Posts: 13

Re: SCL - Opening and running SAS code within frame



I came across this as I am in a similar position. I hope the author does not mind me re-opening this thread.


I have created a frame in SAS/AF with a pushbutton. I would like it to run / execute a sas program (*.sas) and display the results on the screen. I don't know what SCL code I need to use.


An alternative would be to have the option to open an HTM file in the browser when the button is pressed. If I use 'dlgopen' in the properties window of the pushbutton for 'commandonclick', a popup menu appears allowing me to browse to the file but when I finally click open, it opens it in as a text file, so it does not execute the sas file. same thing happens if I choose to open an HTM file, it opens it as a text ( I can see the HTML codes like <head><body> etc..)


All I need is the SCL code that will allow me to


     - execute a sas program when I click on the pushbutton in the sas/af frame so I can view the results in a browser


     - open/display an HTM file (static file located in the c drive) when I click on the push button in the frame


Should you have any question, please let me know.






Ask a Question
Discussion stats
  • 5 replies
  • 4 in conversation