DATA Step, Macro, Functions and more

SCL - Opening and running SAS code within frame

Reply
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 *;
*---------------------------------------------*;
INIT:
*** Maximize the window ***;
call execcmd('ZOOM ON');
*** Populate text box with initial value ***;
txt_SasProg.text = "Click on the Choose Program button.";
RETURN;
*---------------------------------------------*;
* Select PC File to Submit *;
*---------------------------------------------*;
SELECT:
*** Open File Dialog box to choose program ***;
rc=filedialog('open',selfile,'','/sas','*.sas');
*** Set value of text box to selected file ***;
txt_SasProg.text = selfile;
RETURN;

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.
[pre]
SUBMIT CONTINUE;

/* whatever you need to do here */

ENDSUBMIT;
[/pre]
Hope it helps.

Cheers from Portugal

Daniel Santos @ www.cgd.pt
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.
Ask a Question
Discussion stats
  • 4 replies
  • 190 views
  • 0 likes
  • 3 in conversation