<?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: How to read a Snowflake table with array columns into SAS environment using SAS/ACCESS inteface in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975805#M378178</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;I figured it would involve more datasteps but this is exactly what I was looking for. Much appreciated.&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;</description>
    <pubDate>Fri, 26 Sep 2025 17:28:41 GMT</pubDate>
    <dc:creator>arorata</dc:creator>
    <dc:date>2025-09-26T17:28:41Z</dc:date>
    <item>
      <title>How to read a Snowflake table with array columns into SAS environment using SAS/ACCESS inteface</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975686#M378148</link>
      <description>&lt;P&gt;Hi, I am very new to Snowflake. I am trying to create a SAS dataset from a snowflake table using SAS/ACCESS interface to Snowflake. I can successfully connect to Snowflake database and can create a SAS dataset without errors. Problem is that some of the columns are defined as arrays in Snowflake and after bringing data Snowflake databases into SAS environment, SAS reads array objects as a string where each element of original Snowflake array column is quoted and concatenated inside of a square bracket. I would like to read each element of the Snowflake array as a column in SAS. To add to the complexity a Snowflake column array may have different number of elements in each row.&lt;/P&gt;
&lt;P&gt;This is what I have:&lt;/P&gt;
&lt;TABLE border="1" width="99.99987154071664%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="16.666666666666668%" height="30px"&gt;ID&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="30px"&gt;Snowflake Array Column: &lt;STRONG&gt;HCPCS_CD&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;PROC PRINT showing SAS column as a string: &lt;STRONG&gt;HCPCS_CODE&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="16.666666666666668%" height="30px"&gt;1&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="30px"&gt;J3490, J3590, AAAXT&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;["J3490", "J3590", "AAAXT"]&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="16.666666666666668%" height="30px"&gt;2&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="30px"&gt;A990, B210&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;["A990", "B210"]&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="16.666666666666668%" height="30px"&gt;3&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="30px"&gt;C220, B210, J3490, J3590&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;["C220", "B210", "J3490", "J3590"]&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like SAS dataset to have variable HCPCS_CD into multiple character columns one for each element of the array:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="12.5%"&gt;ID&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="12.5%"&gt;&lt;STRONG&gt;HCPCS_CD1&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="25%"&gt;&lt;STRONG&gt;HCPCS_CD2&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="25%"&gt;&lt;STRONG&gt;HCPCS_CD3&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="25%"&gt;&lt;STRONG&gt;HCPCS_CD4&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.5%"&gt;1&lt;/TD&gt;
&lt;TD width="12.5%"&gt;J3490&lt;/TD&gt;
&lt;TD width="25%"&gt;J3590&lt;/TD&gt;
&lt;TD width="25%"&gt;AAAXT&lt;/TD&gt;
&lt;TD width="25%"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.5%"&gt;2&lt;/TD&gt;
&lt;TD width="12.5%"&gt;A990&lt;/TD&gt;
&lt;TD width="25%"&gt;B210&lt;/TD&gt;
&lt;TD width="25%"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="25%"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;C220&lt;/TD&gt;
&lt;TD&gt;B210&lt;/TD&gt;
&lt;TD&gt;J3490&lt;/TD&gt;
&lt;TD&gt;J3590&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If SAS can read a Snowflake array column directly as a SAS array that would work too.&lt;/P&gt;
&lt;P&gt;Thanks and appreciate any help.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Sep 2025 18:29:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975686#M378148</guid>
      <dc:creator>arorata</dc:creator>
      <dc:date>2025-09-24T18:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a Snowflake table with array columns into SAS environment using SAS/ACCESS inteface</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975697#M378151</link>
      <description>&lt;P&gt;You will probably need to write your own code for this.&lt;/P&gt;
&lt;P&gt;SAS dataset do not have arrays.&amp;nbsp; The ARRAY statement is just something you use in a data step to allow you to reference an actual variable via an index into a list.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will need to define the lengths of the variables you want to create and the number of them.&lt;/P&gt;
&lt;P&gt;So something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sas.dataset;
  set snow.table ;
  array HCPCS_CD[4] $5 ;
  do index=1 to min(dim(hcpcs_cd),countw(hcpcs_code,'[,]'));
     hcpcs_cd[index] = dequote(scan(hcpcs_code,index,'[,]'));
  end;
  drop index;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Sep 2025 20:11:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975697#M378151</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-09-24T20:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a Snowflake table with array columns into SAS environment using SAS/ACCESS inteface</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975698#M378152</link>
      <description>&lt;P&gt;Here's the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acreldb/n0qnx5bs1vcs3in0zazami3levju.htm" target="_blank" rel="noopener"&gt;SAS doc page&lt;/A&gt; that references the Snowflake ARRAY data type. You could either use Snowflake functions to unpack the array - see the semi-structured data example in the link or you could use SAS functions and statements to do the same thing. It is up to you which method to use. If your arrays are bigger than 32K then unpacking using Snowflake functions is the only option.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Sep 2025 20:18:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975698#M378152</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2025-09-24T20:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a Snowflake table with array columns into SAS environment using SAS/ACCESS inteface</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975711#M378154</link>
      <description>&lt;P&gt;Yes. You need to write a piece of code to get job done.&lt;/P&gt;
&lt;PRE&gt;&lt;BR /&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID HCPCS_CD $50. ;
cards;
1    ["J3490", "J3590", "AAAXT"]
2	 ["A990", "B210"]
3    ["C220", "B210", "J3490", "J3590"]
;



*Get the max number of columns in HCPCS_CD;
proc sql noprint;
select max(countw(HCPCS_CD,',"[] ','q')) into :max  trimmed from have;
quit;

*Achieve it;
data want;
 set have;
 array x{&amp;amp;max.} $ 80 HCPCS_CD1-HCPCS_CD&amp;amp;max. ; *Each column has length 80;
 do i=1 to countw(HCPCS_CD,',"[] ','q');
   x{i}=dequote(scan(HCPCS_CD,i,',"[] ','q'));
 end;
 drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1758785169866.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/110139iA1653B14C0A1BF98/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1758785169866.png" alt="Ksharp_0-1758785169866.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Sep 2025 07:26:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975711#M378154</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-09-25T07:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a Snowflake table with array columns into SAS environment using SAS/ACCESS inteface</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975742#M378159</link>
      <description>&lt;P&gt;Hi Ksharp,&lt;/P&gt;
&lt;P&gt;Thanks your code works. Tom's code also worked but I am marking yours as the solution because it finds the array with maximum number of elements and computes the number of columns needed. This info is not available to me apriori. Along the same line of thinking is it also possible to determine the length of the longest "word" in the array so I can efficiently set the length of the variables?&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;</description>
      <pubDate>Thu, 25 Sep 2025 15:45:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975742#M378159</guid>
      <dc:creator>arorata</dc:creator>
      <dc:date>2025-09-25T15:45:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a Snowflake table with array columns into SAS environment using SAS/ACCESS inteface</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975743#M378160</link>
      <description>&lt;P&gt;Hi Tom,&lt;/P&gt;
&lt;P&gt;Thanks for your help. Your code worked but I marked Ksharp's code as solution because I uses programming to determine the number of columns needed as I do not have that information apriori at had. Much appreciate your prompt responses.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Sep 2025 15:47:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975743#M378160</guid>
      <dc:creator>arorata</dc:creator>
      <dc:date>2025-09-25T15:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a Snowflake table with array columns into SAS environment using SAS/ACCESS inteface</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975744#M378161</link>
      <description>&lt;P&gt;Hi SASKiwi,&lt;/P&gt;
&lt;P&gt;Thanks for the reference. It is very helpful. In all the examples on that page the name of array elements in the snowflake table is known, [Name, Sex, etc.]. In my case I am not sure how to get that information from existing snowflake table.&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;</description>
      <pubDate>Thu, 25 Sep 2025 15:51:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975744#M378161</guid>
      <dc:creator>arorata</dc:creator>
      <dc:date>2025-09-25T15:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a Snowflake table with array columns into SAS environment using SAS/ACCESS inteface</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975748#M378163</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/225272"&gt;@arorata&lt;/a&gt;&amp;nbsp;,I do not know what is Snowflake, but the complete code to produce a SAS table per your request base on the data you have is as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   input id hcpcs_cd $32.;
   datalines;
1 J3490, J3590, AAAXT
2 A990, B210
3 C220, B210, J3490, J3590
;
run;
proc print data=have;run;
proc sql noprint;
select max(countw(hcpcs_cd,','))
   into :num
   from have;
quit;
data want;
   set have;
   array newcol[&amp;amp;num]$ hcpcs_cd1-hcpcs_cd4;
   do i=1 to &amp;amp;num;
      newcol[i]=scan(hcpcs_cd,i,',');
   end;
   drop hcpcs_cd i;
run;
proc print data=want noobs;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dxiao2017_0-1758815917871.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/110148i45DCA6D26F8775F8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dxiao2017_0-1758815917871.png" alt="dxiao2017_0-1758815917871.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Sep 2025 16:41:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975748#M378163</guid>
      <dc:creator>dxiao2017</dc:creator>
      <dc:date>2025-09-25T16:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a Snowflake table with array columns into SAS environment using SAS/ACCESS inteface</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975773#M378168</link>
      <description>&lt;P&gt;“&lt;SPAN&gt;Along the same line of thinking is it also possible to determine the length of the longest "word" in the array so I can efficiently set the length of the variables?”&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I understand your question. But that is not so easy to get it.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here is how to get the length of longest word:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;data have;
input ID HCPCS_CD $50. ;
cards;
1    ["J3490", "J3590", "AAAXT"]
2	 ["A990", "B210"]
3    ["C220", "B210", "J3490", "J3590"]
;



*Get the max number of columns in HCPCS_CD;
proc sql noprint;
select max(countw(HCPCS_CD,',"[] ','q')) into :max  trimmed from have;
quit;

*Get the  length of the longest word;
data _null_;
 set have end=last;
 retain length .;
 do i=1 to countw(HCPCS_CD,',"[] ','q');
   length=max(length,length(dequote(scan(HCPCS_CD,i,',"[] ','q'))));
 end;
 if last then call symputx('length',length);
run;
%put &amp;amp;=length.;

data want;
 set have;
 array x{*} $ &amp;amp;length. HCPCS_CD1-HCPCS_CD&amp;amp;max. ; 
 do i=1 to countw(HCPCS_CD,',"[] ','q');
   x{i}=dequote(scan(HCPCS_CD,i,',"[] ','q'));
 end;
 drop i;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Sep 2025 07:33:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975773#M378168</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-09-26T07:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a Snowflake table with array columns into SAS environment using SAS/ACCESS inteface</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975791#M378175</link>
      <description>&lt;P&gt;You don't need to two passes through the data to calculate the maximum number of words and the maximum word length.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And note that double quotes should not be considered a delimiter.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*Get the  max number of words and length of the longest word;
data _null_;
  set have end=last;
  retain length 1 max 1;
  n=countw(HCPCS_CD,',[] ','q');
  max=max(n,max);
  do i=1 to n;
    length=max(length,lengthn(dequote(scan(HCPCS_CD,i,',[] ','q'))));
  end;
  if last then do;
    call symputx('length',length);
    call symputx('max',max);
  end;
run;
%put &amp;amp;=max &amp;amp;=length;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Sep 2025 12:33:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975791#M378175</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-09-26T12:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a Snowflake table with array columns into SAS environment using SAS/ACCESS inteface</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975805#M378178</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;I figured it would involve more datasteps but this is exactly what I was looking for. Much appreciated.&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;</description>
      <pubDate>Fri, 26 Sep 2025 17:28:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975805#M378178</guid>
      <dc:creator>arorata</dc:creator>
      <dc:date>2025-09-26T17:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a Snowflake table with array columns into SAS environment using SAS/ACCESS inteface</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975806#M378179</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Thanks for this elegant solution.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;</description>
      <pubDate>Fri, 26 Sep 2025 17:30:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975806#M378179</guid>
      <dc:creator>arorata</dc:creator>
      <dc:date>2025-09-26T17:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a Snowflake table with array columns into SAS environment using SAS/ACCESS inteface</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975847#M378192</link>
      <description>"And note that double quotes should not be considered a delimiter."&lt;BR /&gt;Tom, that is the same thing. 'q' would ignore the double quotes too. You can test it if you don't believe.&lt;BR /&gt;&lt;BR /&gt;And I agree with you combine these two step into one step to save PC source.</description>
      <pubDate>Sat, 27 Sep 2025 06:34:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975847#M378192</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-09-27T06:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a Snowflake table with array columns into SAS environment using SAS/ACCESS inteface</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975867#M378204</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/225272"&gt;@arorata&lt;/a&gt;&amp;nbsp;, I update the code in my previous thread. Just for your reference. This code can be used when your raw data has more variations (I created two more rows in the raw data to illustrate this ) in the &lt;EM&gt;hcpcs_cd&lt;/EM&gt; column. The code and output are as follows.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*prepare raw data*/
data have;
   input id hcpcs_cd /*$60.*/ $56.;
   col_length=length(hcpcs_cd);
   retain maxcollngh;
   maxcollngh=max(maxcollngh,col_length);
   datalines;
1 J3490, J3590, AAAXT
2 A990, B210
3 C220, B210, J3490, J3590
4 A567890AB, B210009CDE, C200, , , CDE2300, AABBCC00112210
5 AABBCCDDEE1234567890
;
run;
proc print data=have noobs;
   var id hcpcs_cd;
run;
data _null_;
   set have end=last;
   if last then 
      call symputx('maxcollngh',maxcollngh);
run;
%put &amp;amp;maxcollngh;/*56*/
/*determine how many new columns
the new dataset has*/
proc sql noprint;
select max(countw(hcpcs_cd,','))
   into :num trimmed
   from have;
quit;
%put &amp;amp;num;/*7*/
/*determine the maximum length
of the new columns*/
data have1;
   set have;
   array len[&amp;amp;num] newcol_len1-newcol_len&amp;amp;num;
   do i=1 to &amp;amp;num;
      len[i]=length(scan(hcpcs_cd,i,','));
   end;
   maxlen_row=max(of newcol_len1-newcol_len&amp;amp;num);
   retain maxlen_newcol;
   maxlen_newcol=max(maxlen_newcol,maxlen_row);
run;
data _null_;
   set have1 end=last;
   if last then 
      call symputx('maxlen_newcol',maxlen_newcol);
run;
%put &amp;amp;maxlen_newcol;/*20*/
/*create new dataset*/
data want;
   set have;
   array newcol[&amp;amp;num]$&amp;amp;maxlen_newcol hcpcs_cd1-hcpcs_cd&amp;amp;num;
   do i=1 to &amp;amp;num;
      newcol[i]=scan(hcpcs_cd,i,',');
   end;
   keep id hcpcs_cd1-hcpcs_cd7;
run;
proc print data=want noobs;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dxiao2017_0-1758996177888.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/110185i31EF50A98FB3F1EE/image-size/large?v=v2&amp;amp;px=999" role="button" title="dxiao2017_0-1758996177888.png" alt="dxiao2017_0-1758996177888.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 27 Sep 2025 18:04:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975867#M378204</guid>
      <dc:creator>dxiao2017</dc:creator>
      <dc:date>2025-09-27T18:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a Snowflake table with array columns into SAS environment using SAS/ACCESS inteface</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975869#M378205</link>
      <description>&lt;P&gt;The purpose of the Q modifier is to treat delimiters inside of quotes as normal characters.&amp;nbsp; But if the double quote character is one of the delimiters then stings quoted with double quotes would look like separate words.&amp;nbsp; Meaning you would need to use single quotes to mask delimiter characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you might want to actually test it as SAS's implementation may not use the same order of operations ( between checking for quoted strings versus checking for delimiters) as I would have done.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;26   data test;
27     input string $40.;
28     without = scan(string,2,'[ ,]','q');
29     with = scan(string,2,'[" ,]','q');
30     put (w:) (=);
31   cards;

without="2 x" with="2 x"
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So it will treat the matched quotes as indicating one word.&lt;BR /&gt;&lt;BR /&gt;But the result also shows that adding double quote as a delimiter is not needed.&lt;/P&gt;
&lt;/LI-SPOILER&gt;</description>
      <pubDate>Sun, 28 Sep 2025 01:22:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975869#M378205</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-09-28T01:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a Snowflake table with array columns into SAS environment using SAS/ACCESS inteface</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975875#M378208</link>
      <description>Tom,&lt;BR /&gt;Agree with you.&lt;BR /&gt;I think this situation is barely appeared .&lt;BR /&gt;Normally , double quote would not be in a word. Or double quote would not be a part of a word.</description>
      <pubDate>Sun, 28 Sep 2025 12:36:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975875#M378208</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-09-28T12:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a Snowflake table with array columns into SAS environment using SAS/ACCESS inteface</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975930#M378217</link>
      <description>Hi arorata, I think all of the steps can be combined into just one data step, i.e., it is possible using one data step to solve the whole question, am I right, what do you think?</description>
      <pubDate>Mon, 29 Sep 2025 10:41:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975930#M378217</guid>
      <dc:creator>dxiao2017</dc:creator>
      <dc:date>2025-09-29T10:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a Snowflake table with array columns into SAS environment using SAS/ACCESS inteface</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975951#M378221</link>
      <description>Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/466238"&gt;@dxiao2017&lt;/a&gt;, I agree with you. &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; and &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt; have already shown the way.&lt;BR /&gt;Kind regards,</description>
      <pubDate>Mon, 29 Sep 2025 15:45:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-Snowflake-table-with-array-columns-into-SAS/m-p/975951#M378221</guid>
      <dc:creator>arorata</dc:creator>
      <dc:date>2025-09-29T15:45:08Z</dc:date>
    </item>
  </channel>
</rss>

