DATA Step, Macro, Functions and more

Running a .sas program within the SAS Frame window (SAS 9.4)

Reply
Occasional Contributor
Posts: 13

Running a .sas program within the SAS Frame window (SAS 9.4)

Hello All,

 

I am new to SAS. I have created a frame with a push button. When the button is clicked, it opens up a file dialog box as shown below, which then selects the *.sas program to run. However, after selecting the file, nothing happens. 

 

From the SCL code of the Frame

dcl num rc;

 

CorresAnalysis: /*push button */

   rc = filedialog('open', selfie,'','/sas','*.sas');

return;

 

Could you please advise what I need to do in order to run a sas program to be displayed in the Frame? If the results of the sas program cannot be displayed in the frame, could you please advise how to open an HTML file in the browser when the button is clicked?

 

Thanks

Sunny

Super User
Super User
Posts: 9,599

Re: Running a .sas program within the SAS Frame window (SAS 9.4)

Posted in reply to sunny_nar2018

Hi,

 

So your using SAS AF/SCL.  As far as I know (and this is just opinion) nobody uses that or has used it for quite some time.  In anything other than PC SAS I don't think its even present anymore.  

 

What is it your trying to do, just run a program as you can use command line for that.  For more complicated projects, there is stored process, .net integration, java, virtual platforms etc. 

Occasional Contributor
Posts: 13

Re: Running a .sas program within the SAS Frame window (SAS 9.4)

Hi RW9,

 

You are right - it is only available on PC. I have a frame already and I just need to open an HTM web page when the push button is clicked and was wondering if you have any idea how to do this? I can see an 'onclickcommand' in the properties window for the push button but thats as far as I can get.

 

Any pointers? I need to have it as a pushbutton.

 

Thanks

Sunny

SAS Super FREQ
Posts: 4,237

Re: Running a .sas program within the SAS Frame window (SAS 9.4)

Posted in reply to sunny_nar2018

Is the "HTML web page" the results of an analysis? A local file? A page on the internet for which you have a URL? Please let us know what kind of file you are trying to display and we can advise you how to accomplish it using modern tools.

Occasional Contributor
Posts: 13

Re: Running a .sas program within the SAS Frame window (SAS 9.4)

Hi Rick_SAS,

 

Thanks for your post. I have only SAS 9.4 TS Level 1M3 at my disposal. The page I want to display is the result of the analysis from PROC CORRESP. At first, I wanted to point the push button to execute the *.sas file as soon as the button is pressed. However, because I have not been able to figure out how to run the sas program from the Frame window, I have now decided to open the result of the analysis in the browser instead.

 

Please do advise.

 

Thanks

Sunny

Super User
Super User
Posts: 8,069

Re: Running a .sas program within the SAS Frame window (SAS 9.4)

Posted in reply to sunny_nar2018

If you want to run a program from SCL you should just use a SUBMIT block.  You can use %INCLUDE statement in the submit block to source in the SAS program file.

Occasional Contributor
Posts: 13

Re: Running a .sas program within the SAS Frame window (SAS 9.4)

Hi Tom,

 

Have you got an example of the SUBMIT block?

 

I have inserted the code below in the correspondence analysis method in the SCL, which does not work:

 

Corresp_Analysis: /* pushbutton */

/* rc=filedialog('open', selfie,'','/sas','*.sas'); */

SUBMIT
%include 'C:\DeckCash\Analysis\menu\Corresp_Analysis_v2.htm';
ENDSUBMIT;

return;

 

When I use FSEDIT procedure, I can run the sas program using the %INCLUDE statement as below - This is ran from a dialogbox (PMENU)

 

FILENAME corresp1 '<path to file *.sas>';

 

menu viz;
item 'Correspondence Analysis' selection=corresp;
selection corresp 'end;pgm;include corresp1;submit';

 

The above works - however, when I use the same menu linked to the frame, it does not produce any result.

 

I hope have not confused you with this. let me know if you have any question.

 

thanks

Sunny

 

Super User
Super User
Posts: 8,069

Re: Running a .sas program within the SAS Frame window (SAS 9.4)

Posted in reply to sunny_nar2018
You are talking about two different things. The PMENU entry is issuing commands that can be issue from the display manager command line.
Check the documentation on-line for the syntax and examples of how to submit SAS code from within an SCL program.
Occasional Contributor
Posts: 13

Re: Running a .sas program within the SAS Frame window (SAS 9.4)

What is the code / statement in SCL that will run a SAS program (*.sas) when a push button is clicked in a SAS frame? thanks

Super User
Super User
Posts: 8,069

Re: Running a .sas program within the SAS Frame window (SAS 9.4)

Posted in reply to sunny_nar2018

The display manager command for submitting code is GSUBMIT.

 

GSUBMIT "%include program;"
Occasional Contributor
Posts: 13

Re: Running a .sas program within the SAS Frame window (SAS 9.4)

Hi Tom,

 

Thanks for your post, after which I used 'GSUBMIT "%include 'Corresp_Analysis.sas';"'; in the Display Manager command window and it  would execute the command successfully. I have now been able to insert the code inside a dialogbox in the menubar, but it then closes the frame when the results are displayed. The same thing happens when I use it with an fsedit procedure. However, I want the SCL equivalent so I can use it in frames when the push button is pressed.

 

I was thinking of using the call execcmd in the SCL program under the pushbutton method 'CorrespAnalysis1' but nothing happens when the push button is pressed and the log does not give any errors.

 

CorrespAnalysis1:

         call execcmd("GSUBMIT %include 'Corresp_Analysis.sas';");

return;

 

Any pointers?

 

Thanks

Sunny

Ask a Question
Discussion stats
  • 10 replies
  • 142 views
  • 0 likes
  • 4 in conversation