<?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: get variable name from vcolumn in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/get-variable-name-from-vcolumn/m-p/947757#M370960</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;I would still like to get the variable list from data, but I feel something in 'Label' cause the issue. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 16 Oct 2024 20:39:11 GMT</pubDate>
    <dc:creator>stataq</dc:creator>
    <dc:date>2024-10-16T20:39:11Z</dc:date>
    <item>
      <title>get variable name from vcolumn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-variable-name-from-vcolumn/m-p/947682#M370936</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to get the variables that contain "_raw" in my folder. I tried&amp;nbsp; to utilized vcolumn but got following error message. Could anyone told me how to work around it?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data varlst;
	set sashelp.vcolumn;
 if  libname = 'RAW' and index(name,'_RAW') ; 
	keep memname name label;
run;

ERROR: Some character data was lost during transcoding in the dataset RAW.XXX. Either the data contains characters that are not representable in the new encoding or truncation occurred during transcoding.
ERROR: SQL View SASHELP.VCOLUMN could not be processed.
&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Oct 2024 14:17:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-variable-name-from-vcolumn/m-p/947682#M370936</guid>
      <dc:creator>stataq</dc:creator>
      <dc:date>2024-10-16T14:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: get variable name from vcolumn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-variable-name-from-vcolumn/m-p/947686#M370939</link>
      <description>&lt;P&gt;You have a dataset with an encoding different from your session encoding.&lt;/P&gt;
&lt;P&gt;You need to switch to a SAS session with an encoding matching that of the dataset.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2024 14:51:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-variable-name-from-vcolumn/m-p/947686#M370939</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-10-16T14:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: get variable name from vcolumn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-variable-name-from-vcolumn/m-p/947691#M370940</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;It looks like my SAS is using&amp;nbsp;WLATIN1 and the datasets used&amp;nbsp;UTF-8. What should I do to overcome this difference?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2024 15:46:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-variable-name-from-vcolumn/m-p/947691#M370940</guid>
      <dc:creator>stataq</dc:creator>
      <dc:date>2024-10-16T15:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: get variable name from vcolumn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-variable-name-from-vcolumn/m-p/947694#M370942</link>
      <description>&lt;P&gt;Not sure why a query of SASHELP.VCOLUMN would cause SAS to check any of the values of any variables in any of the datasets.&amp;nbsp; Is it possible you have some VIEWS that might be referencing the RAW.XXX dataset so that trying the get the metadata about which variables are in the dataset caused SAS to actually try to read the RAW.XXX dataset?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could try using a WHERE statement instead of an IF condition to filter the observations before they make it into the data step.&amp;nbsp; But note that the SASHELP views will not honor WHERE conditions, so SASHELP.VCOLUMN will still try to query every open libref, not just the RAW libref.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So try using DICTIONARY.COLUMNS directly and see if that helps any.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table varlst as
  select memname,name,label
  from dictionary.columns
  where libname = 'RAW' 
    and index(upcase(name),'_RAW')
 ; 
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Oct 2024 15:53:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-variable-name-from-vcolumn/m-p/947694#M370942</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-10-16T15:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: get variable name from vcolumn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-variable-name-from-vcolumn/m-p/947695#M370943</link>
      <description>&lt;P&gt;Use a SAS session configured for UTF-8. How you do this depends on your SAS setup (local or client/server). When server-based, you need to consult your SAS admin.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2024 15:53:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-variable-name-from-vcolumn/m-p/947695#M370943</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-10-16T15:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: get variable name from vcolumn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-variable-name-from-vcolumn/m-p/947696#M370944</link>
      <description>&lt;P&gt;The problem is: to get the names of the variables, the DICTIONARY.COLUMNS pseudo-table has to read at least the header of each dataset.&lt;/P&gt;
&lt;P&gt;It might even be that someone was crazy enough to use a UTF character in a name literal.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2024 15:57:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-variable-name-from-vcolumn/m-p/947696#M370944</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-10-16T15:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: get variable name from vcolumn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-variable-name-from-vcolumn/m-p/947702#M370947</link>
      <description>&lt;P&gt;Using "where' instead of 'if' doesn't change the situation. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using sas server and probably wont be able to change my session setup. Is it a way to convert dataset so I can still read it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2024 16:12:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-variable-name-from-vcolumn/m-p/947702#M370947</guid>
      <dc:creator>stataq</dc:creator>
      <dc:date>2024-10-16T16:12:18Z</dc:date>
    </item>
    <item>
      <title>Re: get variable name from vcolumn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-variable-name-from-vcolumn/m-p/947708#M370950</link>
      <description>&lt;P&gt;Are you asking how to read a dataset with UTF-8 codes that cannot translate into the single byte encoding that your current SAS session is using?&amp;nbsp; &amp;nbsp;(A different question than getting list of variable names from SAS metadata.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the ENCODING='ANY' dataset option to get the values into your data step.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set raw.xxx(encoding='any');
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;At that point you can try to craft your own logic to find the characters that cannot be transcoded and change them to something else.&amp;nbsp; For example what if you have the UTF-8 code for uppercase Greek Delta character?&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  length _raw $4;
  _raw='CE94'x;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1729096174144.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/101324i760083542D9E9157/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_0-1729096174144.png" alt="Tom_0-1729096174144.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;What character(s) in WLATIN1 would you want to translate 'CE94'x into?&lt;/P&gt;
&lt;P&gt;You might try replacing it with the word Delta, but make sure that the variable is long enough to store the extra 3 bytes needed.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  length _raw $10 ;
  set test(encoding='any');
  _raw=tranwrd(_raw,'CE94'x,'Delta');
run;

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV id="tinyMceEditorTom_2" class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1729096834506.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/101325iCCA333F60C22FE4C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_0-1729096834506.png" alt="Tom_0-1729096834506.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2024 16:40:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-variable-name-from-vcolumn/m-p/947708#M370950</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-10-16T16:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: get variable name from vcolumn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-variable-name-from-vcolumn/m-p/947757#M370960</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;I would still like to get the variable list from data, but I feel something in 'Label' cause the issue. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2024 20:39:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-variable-name-from-vcolumn/m-p/947757#M370960</guid>
      <dc:creator>stataq</dc:creator>
      <dc:date>2024-10-16T20:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: get variable name from vcolumn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-variable-name-from-vcolumn/m-p/947766#M370962</link>
      <description>&lt;P&gt;As an end user in a server-based environment, you can't change the session encoding, but the SAS administrator can provide one for you.&lt;/P&gt;
&lt;P&gt;And you&amp;nbsp;&lt;EM&gt;will&lt;/EM&gt; need one to read that particular (and probably a lot others) dataset.&lt;/P&gt;
&lt;P&gt;Keep in mind that &lt;EM&gt;someone&lt;/EM&gt; was able to create that dataset in your organisation, so there&amp;nbsp;&lt;EM&gt;must&lt;/EM&gt; be a UTF-encoded workspace server available.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2024 21:07:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-variable-name-from-vcolumn/m-p/947766#M370962</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-10-16T21:07:27Z</dc:date>
    </item>
  </channel>
</rss>

