BookmarkSubscribeRSS Feed

How to create a connection to SAS Data Sets in SAS Data Management Studio and Server

Started ‎01-21-2016 by
Modified ‎01-19-2016 by
Views 3,317

In data and process jobs, you can read and write to SAS Data Sets. But before you do that, you need to create a connection to these SAS Datasets. Here's how to do it in SAS Data Management Studio and Server.

 

Data Management Studio

 

In the Data Management Studio home page, go to the Data riser, right click on Data Connections > New Data Connection and then select SAS Data Set Connection.

New Connection.png

 

A new SAS Data Connection dialog opens:

Dialog.png

 

 

  • Enter a name (mandatory) and description.
  • Enter the path to the directory (mandatory) that contains one or more SAS data sets. You do not have to create one connection for each file, but one connection for each folder. It has to be a path you can access from that machine. If the SAS Datasets are not located on that machine, you need to have a valid path to access them.
  • Verify that the appropriate option is specified in the Access field. DEFAULT is read-write access. READ-ONLY assigns a read-only access. TEMP specifies that the data set be treated as a scratch file.
  • Verify that the appropriate option is specified in the Compression field. If you compress data, you might experience a slowdown in performance. NO specifies that the observations are uncompressed. Use YES or CHAR to compress character data. Use BINARY to compress binary data.
  • Verify that the appropriate option is specified in the Table Locking field. SHARE specifies that other users or processes can read data from the table but prevents other users from updating. EXCLUSIVE locks tables exclusively which prevents other users from accessing any table you open.
  • Verify that the appropriate option is specified in the Encoding field. The default is the SAS System encoding. You might select an encoding that is different than the default if you are processing a file with a different encoding. You can select an encoding from the drop-down menu. If you type the first few letters of the desired encoding, the closest match will be added to this field. A list of available encodings is available in Data Management Studio HTML help under Appendixes > Encodings for SAS Data Sets.
  • Connection String - Displays the connection string for the SAS data set. Check the connection string to see if the appropriate encodings option has been selected for this connection.

You can test the connection by clicking Test Connection. Then, click OK to save the new connection and return to the Data riser.

To see the new connection in the Data Connections folder, you'll need to Refresh the Data Riser.

 

By default, it will create a new dftk file under Data Management Studio etc\dftkdsn folder. This dftk file name will be the name of your Data Connection. You can open that file in a text editor, which will look like this:

 

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<datafluxdocument class="dftkdsn" version="1.0">

  <name>My Data Connection</name>
  <description>Its Description</description>
  <extprops>DFTYPE=SAS;</extprops>
  <type>TKTS</type>
  <domain></domain>

  <attributes>
    <attribute name="CATALOG">BASE</attribute>
    <attribute name="DRIVER">BASE</attribute>
    <attribute name="Schema">(name='SAS';primarypath='Path\To\Data\';COMPRESS=NO;LOCKTABLE=SHARE;)</attribute>
  </attributes>

</datafluxdocument>


Administrators can specify where SAS data set connections are stored using the TKTS DSN directory setting.

 

Data Management Server

 

In Data Management Server, there is no dialog to create the connection. The easiest way is to create one is in Data Management Studio, and then copy the dftk file from Data Management Studio etc\dftkdsn to the Data Management Server dftkdsn folder. If the Data Management Server is located on a different machine, you'll most likely need to edit the primarypath value. Also, you need to verify that the compression, sharing and encoding values are still correct.

 

Version history
Last update:
‎01-19-2016 11:12 AM
Updated by:
Contributors

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!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Labels
Article Tags