Hi,
I am writing a SAS application in SCL that takes random samples of a uniform distriubtion (using macros) to show that as the sample size increases, the sampling distribution of the mean takes on a more normal shape (I plan on doing it for multiple distributions, once I figure out the Uniform first). My program works like this at the moment: the user selects a distribution and then the %macro uniform and %macro usd are both compiled and executed. Then the proc univariate displays the moments of the sample distribution. In the picture of my frame, you can ignore the number of sample(s) and size of sample(s), textlabels and textentry boxes because I have not gotten to that step in my program yet.
I have searched the web for a long time now and can't really find many examples creating applications using SCL. My code is kind of long, so if any one can help I would appreciate it.
My goal is to get: proc sgplot and proc univariate html ouput into the component windows, but I have only been able to get listing output in my external file viewer control (I might need to try a different component, such as graph output control). Any help would be nice. Thanks.
dcl num rc;
dcl list messageList = {};
dcl char(10) distribution,
char(2) command;
Init:
rc = insertc(messageList, 'To create the report, please select a distribution');
rc = filename('out', ' ', 'temp');
ReportViewer._showEndOfFile('no');
return;
CreateRptButton:
if ReportViewer.fileref ne ' ' then ReportViewer.fileref = ' ';
distribution = distComboBox.selectedItem;
if distribution ne ' ' then do;
submit continue;
proc printto print=out new;
ods noproctitle;
options nodate nonumber nocenter;
%macro Uniform;
%local i k;
data work.uniform;
call streaminit(1234);
%do i=1 %to 10;
%do k=1 %to 10;
Sample&k=10*rand("Uniform");
%end;
output;
%end;
run;
%mend Uniform;
%Uniform
proc transpose data=work.uniform out=work.uniform1 name=sample;
run;
%macro usd;
%local i;
data work.usd(drop=col1-col10);
set work.uniform1;
%do i=1 %to 10;
sample_mean=mean(of col1-col10);
%end;
run;
%mend usd;
%usd
ods select moments;
proc univariate data= work.usd;
var sample_mean;
run;
proc printto;
run;
options date number center;
endsubmit;
ReportViewer.fileref='out';
end;
else command = messagebox(messageList, '!', 'O', 'Application warning message');
return;
Term:
messageList = dellist(messageList);
reportViewer.fileref = ' ';
rc = filename('out', ' ');
return;
Hi,
Sorry, I can't really help you, last time I used AF/SCL was back in 2000! I wouldn't recommend using it. SAS has the ability to interact with the big languages of the time:
Java:
https://support.sas.com/resources/thirdpartysupport/v93/jres.html
.Net:
http://support.sas.com/rnd/itech/doc9/dev_guide/dist-obj/winclnt/windotnet.html
Not to mention R, Python, VB etc. or in fact anything you can call from the command line or via process.
There are alos other simpler things you could try, for instance, you have two boxes for paramters, just pop them in a program at the top as:
%let no_samples=;
%let size=;
Then have the proc sgplot and univariate use those macro parameters. Thats the simplest way.
Hi
I agree with @RW9 I would no longer develop SCL based applications.
Here is a brief guide on how to use OLE objects within your frame entry, provided you run SAS on windows.
Please note this guide was created in 2002.
The sashelp.classes.insert_c class is basically a dot notation style object of the SAS Version 6 "OLE - Insert Object". You can still use the SAS Version 6 one if you want, but then you won't be able to do simple dot notation with it.
The following steps outline how one can use any OLE object within a frame using the sashelp.classes.insert_c class:
Unfortunately since Windows 2000 the "Microsoft Web Browser" is not available anymore. There have been some discussions on how one can add it, so it will appear on the list. The following steps worked for me:
c:\winnt\system32\mshtml.dll
.
A test on my system that I can not find the above mentioned module, there are plenty of other for Excel, RTF or PDF etc.
Maybe this will help you.
Bruno
@RW9 thanks for the input. My original sas macros do exactly what you said. %uniform(Num=, Size=) and %usd(Num=&num, Size=&size), since it was executed in the %uniform(Num=, Size=) macro. I thought it would be cool to try and write an application (in SAS) that lets the user select a distriubtion, number of samples, and size of samples that shows its sampling distribution about the mean. I will look into Python. I have used it before, but have not in a while, so I will have to learn the basic code again.
@BrunoMuellerthanks for the input. I will look into the OLE insert class.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: