The script uses the SASHELP.RETAIL library, which is a standard SAS example data library, accessible via a remote SAS/SHARE server. Server connection and operation parameters (IDs, passwords) are defined directly in the code.
1 Code Block
PROC SERVER
Explanation : This code block starts a SAS/SHARE server instance. It assigns it the identifier 'shr1', configures passwords for the administrator ('oapw=system') and the user ('uapw=user'), and enforces mandatory authentication for connections.
Copied!
proc server id=shr1 oapw=system uapw=user
authenticate=required;
run;
1
2
PROC SERVER id=shr1 oapw=system uapw=user
3
authenticate=required;
4
RUN;
5
2 Code Block
PROC OPERATE
Explanation : This code block is used to stop the SAS/SHARE server. It targets the server with the identifier 'shr1', uses a system administrator password ('sapw=system'), and prompts the user to provide their UID during execution ('uid=_prompt'). The 'stop server;' command initiates the shutdown.
Explanation : This block first establishes a connection to a remote SAS library. The LIBNAME statement 'SHARED' points to the 'SASHELP' library on the SAS/SHARE server 'hrothgar.shr1', requiring a user password. Then, PROC PRINT is used to display a subset of the 'RETAIL' data from this remote library, filtering years after 1990 and selecting specific variables for the report.
Copied!
libname SHARED slibref=SASHELP server=hrothgar.shr1
sapw=user passwd=_prompt_;
proc print data=SHARED.RETAIL;
title "Retail Sales Total by Month: 1991-1994";
where YEAR gt 1990;
var MONTH SALES;
id YEAR;
run;
Explanation : This block uses PROC SQL to execute a SQL Pass-Through query on the remote SAS/SHARE server 'hrothgar.shr1'. It connects to the server and executes a subquery that selects the year, month, and sum of sales (renamed 'Total Sales') from the SASHELP.RETAIL table, grouped by year and month. The result of this remote query is then selected and displayed by PROC SQL locally.
Copied!
proc sql;
connect to remote
(server=hrothgar.shr1 sapw=user passwd=_prompt_);
select * from connection to remote
(select YEAR, MONTH, sum(SALES)
format=dollar12. label='Total Sales'
from SASHELP.RETAIL
group by YEAR, MONTH);
quit;
1
PROC SQL;
2
3
connect to remote
4
(server=hrothgar.shr1 sapw=user passwd=_prompt_);
5
6
select * from connection to remote
7
(select YEAR, MONTH, sum(SALES)
8
FORMAT=dollar12. label='Total Sales'
9
from SASHELP.RETAIL
10
group BY YEAR, MONTH);
11
QUIT;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : Copyright (c) 1993-1999 Microsoft Corp.
« Always utilize the _prompt_ or _prompt_ keyword for password variables. This ensures compliance with security auditing standards by keeping sensitive credentials out of log files and source code. »
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.