Connect from a SAS session
to an SPD Server SQL server. Execute a CONNECT statement. After making
the connection, the first EXECUTE statement creates a table named
LOTTERYWIN with two columns—TICKETNO and WINNAME. The second
EXECUTE statement inserts an observation into the table where TICKETNO
equals 1 and NAME equals Wishu Weremee.
The subsequent FROM
CONNECTION TO statement retrieves all of the records from the new
LOTTERYWIN table. (In this example, it retrieves a single observation
inserted by the second EXECUTE statement. The DISCONNECT statement
terminates the connection.
proc sql;
connect to sasspds (dbq='mydomain'
host='workstation1' serv='spdsname'
user='me' passwd='luckyones');
execute (create table lotterywin
(ticketno num, winname char(30))) by sasspds;
execute (insert into lotterywin
values (1, 'Wishu Weremee')) by sasspds;
select * from connection to sasspds
(select * from employee);
disconnect from sasspds;
quit;