<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SAS to Snowflake data load using Key Pair in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-to-Snowflake-data-load-using-Key-Pair/m-p/987819#M380082</link>
    <description>&lt;P&gt;PERM is the only LIBREF you have defined for Snowflake. If you want to read a SAS table and write it to Snowflake in a DATA step the syntax should look like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data perm.cars;
    set sashelp.cars;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 12 May 2026 20:15:48 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2026-05-12T20:15:48Z</dc:date>
    <item>
      <title>SAS to Snowflake data load using Key Pair</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-to-Snowflake-data-load-using-Key-Pair/m-p/987808#M380079</link>
      <description>&lt;DIV&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Hello All,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;I’m trying to write a SAS program to load data from a SAS dataset into Snowflake using key-pair authentication.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;We have defined the LIBNAME statement in the backend configuration so that the Snowflake library is automatically assigned without specifying the role, warehouse, schema, and database. This is because multiple teams use the same setup, and each team has its own role, warehouse, and other parameters. Therefore, we intentionally excluded these details from the LIBNAME definition.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT size="2"&gt;Instead, we have asked users to specify the required context (role, warehouse, database, schema) within their SAS code. However, when attempting to load data from a SAS dataset into Snowflake using this approach, we have been unable to find the correct SAS syntax.&lt;/FONT&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT size="2"&gt;We have tried several approaches, but none have worked successfully.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT size="2"&gt;Below code uses snow libref which is defined in backend and automatically assigned when the session starts.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname perm "/mnt/test/_shared";
%let DB=SANDBOX_DATABASE;
%let schema=SANDBOX_SCHEMA;

proc sql ;
connect using snow as snow;
execute ( USE ROLE SANDBOX_ROLE) by snow;
execute ( USE WAREHOUSE SANDBOX_VWH ) by snow;

quit;

data snow."&amp;amp;DB"."&amp;amp;SCHEMA"."cars1"n;
    set perm.test_dataset;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;CODE class=" language-sas"&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, /, ;, _DATA_, _LAST_, _NULL_.  
ERROR 201-322: The option is not recognized and will be ignored.&lt;/CODE&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;DIV&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Since we are using key-pair authentication, we are unable to share details such as the private key file location and encryption key. This is why the LIBNAME is configured in the backend, and users are only expected to define role/warehouse/database/schema in their code.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;At this point, we are unsure how to proceed and would appreciate any guidance or best practices to resolve this issue.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Thanks in advance for your help.&lt;/FONT&gt;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 12 May 2026 16:11:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-to-Snowflake-data-load-using-Key-Pair/m-p/987808#M380079</guid>
      <dc:creator>freshstarter</dc:creator>
      <dc:date>2026-05-12T16:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: SAS to Snowflake data load using Key Pair</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-to-Snowflake-data-load-using-Key-Pair/m-p/987819#M380082</link>
      <description>&lt;P&gt;PERM is the only LIBREF you have defined for Snowflake. If you want to read a SAS table and write it to Snowflake in a DATA step the syntax should look like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data perm.cars;
    set sashelp.cars;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 May 2026 20:15:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-to-Snowflake-data-load-using-Key-Pair/m-p/987819#M380082</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2026-05-12T20:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: SAS to Snowflake data load using Key Pair</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-to-Snowflake-data-load-using-Key-Pair/m-p/987821#M380083</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;for your response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Currently the SAS dataset is stored in the library called PERM which points to this location&amp;nbsp;/mnt/test/_shared. Snowflake library called SNOW is defined in the autoexec file. something like below which do not have role,warehouse, database and schema.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;LIBNAME SNOW SNOW
dsn=snowflake
CONOPTS="AUTHENTICATOR=SNOWFLAKE_JWT;
PRIV_KEY_FILE=/LOCATION/OF/KEY/rsa_key.p8;
PRIV_KEY_FILE_PWD=XXXXXXXXXXX;"&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;As I mentioned before , I cant define the role ,database , warehouse and schema in the libname statement and we planned to use these in SAS code after the libname is assigned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But below code didnot work for us. We tried to pass the database , schema in the data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ;
connect using snow as snow;
execute ( USE ROLE SANDBOX_ROLE) by snow;
execute ( USE WAREHOUSE SANDBOX_VWH ) by snow;

quit;

data snow."&amp;amp;DB"."&amp;amp;SCHEMA"."cars1"n;
    set perm.test_dataset;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 May 2026 20:32:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-to-Snowflake-data-load-using-Key-Pair/m-p/987821#M380083</guid>
      <dc:creator>freshstarter</dc:creator>
      <dc:date>2026-05-12T20:32:04Z</dc:date>
    </item>
    <item>
      <title>Re: SAS to Snowflake data load using Key Pair</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-to-Snowflake-data-load-using-Key-Pair/m-p/987832#M380084</link>
      <description>&lt;P&gt;If you use a DATA step with Snowflake then the database, and schema must be defined in the LIBNAME statement. You can only use a LIBREF and a table name in the DATA statement like in the example I posted.&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2026 21:29:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-to-Snowflake-data-load-using-Key-Pair/m-p/987832#M380084</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2026-05-12T21:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: SAS to Snowflake data load using Key Pair</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-to-Snowflake-data-load-using-Key-Pair/m-p/987834#M380085</link>
      <description>&lt;P&gt;Don't know about ROLE, but why not try using the SCHEMA= dataset option.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data snow.mytable(schema="myschema");
  set perm.mydataset;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 May 2026 23:37:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-to-Snowflake-data-load-using-Key-Pair/m-p/987834#M380085</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-05-12T23:37:05Z</dc:date>
    </item>
  </channel>
</rss>

