<?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 deal with spaces in variable names using SAS DI in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/how-to-deal-with-spaces-in-variable-names-using-SAS-DI/m-p/775412#M20129</link>
    <description>Thanks it worked!</description>
    <pubDate>Wed, 20 Oct 2021 14:29:09 GMT</pubDate>
    <dc:creator>sassy7</dc:creator>
    <dc:date>2021-10-20T14:29:09Z</dc:date>
    <item>
      <title>how to deal with spaces in variable names using SAS DI</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/how-to-deal-with-spaces-in-variable-names-using-SAS-DI/m-p/773913#M20122</link>
      <description>&lt;P&gt;I am writing a job for selecting some observations from the AUDIT data source of SAS VA: the data source contains three variables that have spaces in their name (the variables are: User ID, Time Stamp and&amp;nbsp;Remote Address). With SAS Studio, I was able to write and execute a program that creates a smaller dataset using data step (or proc sql), but I am having issue using the same code in SAS DI.&lt;/P&gt;&lt;P&gt;the code is the following:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;libname xyz cas caslib=XYZ datalimit=all;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data work.audit_select;&lt;BR /&gt;set xyz.audit;&lt;BR /&gt;where Application="reports" and&lt;BR /&gt;URI contains ".report" and&lt;BR /&gt;'User ID'n not contains "sas.";&lt;BR /&gt;if intck ('day', input(substr('Time Stamp'n,1,10), yymmdd10.), today()) &amp;lt; 3 then output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the error message I receive is&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: The name Time Stamp is not a valid SAS name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Any suggestion how to handle spaces in names in SAS DI studio?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Oct 2021 12:39:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/how-to-deal-with-spaces-in-variable-names-using-SAS-DI/m-p/773913#M20122</guid>
      <dc:creator>sassy7</dc:creator>
      <dc:date>2021-10-13T12:39:45Z</dc:date>
    </item>
    <item>
      <title>Re: how to deal with spaces in variable names using SAS DI</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/how-to-deal-with-spaces-in-variable-names-using-SAS-DI/m-p/773914#M20123</link>
      <description>&lt;P&gt;Why would it complain about 'Time Stamp'n and not 'User ID'n.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have to working with non-standard variable names then make sure the VALIDVARNAME option is set to ANY.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options validvarname=any;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Oct 2021 12:50:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/how-to-deal-with-spaces-in-variable-names-using-SAS-DI/m-p/773914#M20123</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-10-13T12:50:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to deal with spaces in variable names using SAS DI</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/how-to-deal-with-spaces-in-variable-names-using-SAS-DI/m-p/773928#M20124</link>
      <description>&lt;P&gt;working with cas I have the same issue now and then.&lt;/P&gt;
&lt;P&gt;The way to solve it is placing the code into a datastep.runcode in order to rename the variable.&lt;/P&gt;
&lt;P&gt;It doesn't make sense to me WHY it works but it does.&lt;/P&gt;
&lt;P&gt;Every time I have this error message (normally related to variable names longer than 32) I can fix it using this trick.&lt;/P&gt;
&lt;P&gt;In SAS Studio use the caslib menu, open the caslib, open the table and drag&amp;amp;drop the variable name into the code.&lt;/P&gt;
&lt;P&gt;During the import sometimes blank characters or other strange ones are woven into the variable name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc cas;
action table.tableexists result=rc/
name="audit" caslib="xyz";
run; 
if rc.exists then dataStep.runCode result=r status=rc / code=
'data public.temp;
	set xyz.audit;
rename "time stamp"n=time_stamp; 
run;';&lt;BR /&gt;&lt;BR /&gt;data work.audit_select;&lt;BR /&gt;set public.temp;&lt;BR /&gt;where Application="reports" and&lt;BR /&gt;URI contains ".report" and&lt;BR /&gt;'User ID'n not contains "sas.";&lt;BR /&gt;if intck ('day', input(substr(Time_Stamp,1,10), yymmdd10.), today()) &amp;lt; 3 then output;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Oct 2021 13:59:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/how-to-deal-with-spaces-in-variable-names-using-SAS-DI/m-p/773928#M20124</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2021-10-13T13:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: how to deal with spaces in variable names using SAS DI</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/how-to-deal-with-spaces-in-variable-names-using-SAS-DI/m-p/775412#M20129</link>
      <description>Thanks it worked!</description>
      <pubDate>Wed, 20 Oct 2021 14:29:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/how-to-deal-with-spaces-in-variable-names-using-SAS-DI/m-p/775412#M20129</guid>
      <dc:creator>sassy7</dc:creator>
      <dc:date>2021-10-20T14:29:09Z</dc:date>
    </item>
  </channel>
</rss>

