BookmarkSubscribeRSS Feed
jonesm11
Calcite | Level 5
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
5 REPLIES 5
Flip
Fluorite | Level 6
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.
jonesm11
Calcite | Level 5
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
DanielSantos
Barite | Level 11
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
jonesm11
Calcite | Level 5
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.
sunny_nar2018
Obsidian | Level 7

Hi,

 

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

either

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

or 

     - 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.

 

Thanks

Sunny

 

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 975 views
  • 0 likes
  • 4 in conversation