<?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 handle variable names with spaces and more than 32 leangth in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-handle-variable-names-with-spaces-and-more-than-32/m-p/330773#M74275</link>
    <description>&lt;P&gt;What you need to show then is&amp;nbsp;&lt;STRONG&gt;labels&lt;/STRONG&gt; not variable names. &amp;nbsp;Variable names are for programming, variable labels are for display. &amp;nbsp;Names are short, minimal characters to enable programming, labels are anything and used for people to read. &amp;nbsp;You can get your labels out to Excel in any number of ways, ods tagsets.excelxp and proc report is my preferred. &amp;nbsp;As you haven't shown anything about what you are doing, how you get your output its hard to say.&lt;/P&gt;
&lt;P&gt;You can, and I say that very loosely as it is highly recommended not to do this, reference variable names by using named literals:&lt;/P&gt;
&lt;P&gt;'a long variable name'n&lt;/P&gt;
&lt;P&gt;Note the n afterwards, however again,&amp;nbsp;&lt;STRONG&gt;highly not&lt;/STRONG&gt; recommended. &amp;nbsp;If I saw this in my code it would be removed immediately.&lt;/P&gt;</description>
    <pubDate>Wed, 08 Feb 2017 10:29:20 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-02-08T10:29:20Z</dc:date>
    <item>
      <title>How to handle variable names with spaces and more than 32 leangth</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-handle-variable-names-with-spaces-and-more-than-32/m-p/330767#M74273</link>
      <description>&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;I need to handle variable names with spaces and more than 32 char leangth .&lt;/P&gt;&lt;P&gt;Variable names with spaces- I need to show variable names in excel , the format my client need in this format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know if there is any way&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 10:10:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-handle-variable-names-with-spaces-and-more-than-32/m-p/330767#M74273</guid>
      <dc:creator>ambadi007</dc:creator>
      <dc:date>2017-02-08T10:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle variable names with spaces and more than 32 leangth</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-handle-variable-names-with-spaces-and-more-than-32/m-p/330773#M74275</link>
      <description>&lt;P&gt;What you need to show then is&amp;nbsp;&lt;STRONG&gt;labels&lt;/STRONG&gt; not variable names. &amp;nbsp;Variable names are for programming, variable labels are for display. &amp;nbsp;Names are short, minimal characters to enable programming, labels are anything and used for people to read. &amp;nbsp;You can get your labels out to Excel in any number of ways, ods tagsets.excelxp and proc report is my preferred. &amp;nbsp;As you haven't shown anything about what you are doing, how you get your output its hard to say.&lt;/P&gt;
&lt;P&gt;You can, and I say that very loosely as it is highly recommended not to do this, reference variable names by using named literals:&lt;/P&gt;
&lt;P&gt;'a long variable name'n&lt;/P&gt;
&lt;P&gt;Note the n afterwards, however again,&amp;nbsp;&lt;STRONG&gt;highly not&lt;/STRONG&gt; recommended. &amp;nbsp;If I saw this in my code it would be removed immediately.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 10:29:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-handle-variable-names-with-spaces-and-more-than-32/m-p/330773#M74275</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-02-08T10:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle variable names with spaces and more than 32 leangth</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-handle-variable-names-with-spaces-and-more-than-32/m-p/330798#M74284</link>
      <description>&lt;P&gt;I use the attached macro to export data in to an excel . The template excel will be there in one folder and will call this macro in the job for exporting&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro exportfile(pathname=, data=); 
libname _lbxls odbc noprompt="dsn=Excel Files; dbq=&amp;amp;pathname"; 

proc datasets lib=_lbxls; 
delete 'Data$'n; 
run; 

proc datasets lib=_lbxls; 
delete Data; 
run; 

proc append 
base=_lbxls.Data 

data=&amp;amp;data; 
run; 

libname _lbxls clear; 
%mend exportfile; 


%macro exportreport(path=, name=, date=, format=, data=); 
data _NULL_; 

src=&amp;amp;path || &amp;amp;name || '.xlsx'; 
src2 = &amp;amp;path || &amp;amp;name || '.xls'; 

dest = &amp;amp;path || &amp;amp;name || ' ' || put(&amp;amp;date, &amp;amp;format) || '.xlsx'; 
dest2 = &amp;amp;path || &amp;amp;name || ' ' || put(&amp;amp;date, &amp;amp;format) || '.xls'; 

if (fileexist(src)) then 
        do; 
                call system('copy ' || quote(src) || ' ' || quote(dest)); 
                call symput('_exportreportpathname', dest); 
        end; 
 else if (fileexist(src2)) then 
        do; 
                call system('copy ' || quote(src2) || ' ' || quote(dest2)); 
                call symput('_exportreportpathname', dest2); 
        end; 

run; 

%exportfile(pathname=&amp;amp;_exportreportpathname., data=&amp;amp;data); 
%mend exportreport;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Feb 2017 11:45:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-handle-variable-names-with-spaces-and-more-than-32/m-p/330798#M74284</guid>
      <dc:creator>ambadi007</dc:creator>
      <dc:date>2017-02-08T11:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle variable names with spaces and more than 32 leangth</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-handle-variable-names-with-spaces-and-more-than-32/m-p/330801#M74286</link>
      <description>&lt;P&gt;If you already have a template excel file which your sending data to, why do you need variable names/labels, why are they not already in this template Excel file?&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 11:48:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-handle-variable-names-with-spaces-and-more-than-32/m-p/330801#M74286</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-02-08T11:48:18Z</dc:date>
    </item>
  </channel>
</rss>

