<?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: Prevent Macro from truncating character variable name when moving to Excel in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916216#M41008</link>
    <description>&lt;P&gt;Can you make a small example that demonstrates the problem, which we could try running?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, I ran this code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;LIBNAME READMIT EXCEL "Q:\junk\myexcel.xls";

data have ;
  var='01234567890123456789012345678901234567890123456789' ;
run ;

DATA READMIT.DATA2; 
   SET have;
RUN;

libname readmit clear ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But it did not truncate the value written to Excel.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since your problem is not resolved, I would recommend you undo marking my the accepted solution.&amp;nbsp; I think there is a button that says "unaccept as solution" or "this is not the solution" or something like that.&amp;nbsp; When you mark a question as correct/accepted, some people will stop reading the thread.&lt;/P&gt;</description>
    <pubDate>Wed, 14 Feb 2024 22:49:34 GMT</pubDate>
    <dc:creator>Quentin</dc:creator>
    <dc:date>2024-02-14T22:49:34Z</dc:date>
    <item>
      <title>Prevent truncating character variable name when moving to Excel</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916077#M40993</link>
      <description>&lt;P&gt;I am running the below code to send data to Excel but have noticed that is truncates the Name(Hospital) variable. Is there a way to keep from cutting off the name when sending to Excel? Below is the code I'm using.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%MACRO&lt;/STRONG&gt; READMIT_RPT_30(HOSPITAL, HOSPITAL_ID, RPTMONTH, PAID,flag);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%PUT COPY TEMPLATE TO DIRECTORY;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let xls_orig_30 = E:\XDrive\Payor Provider\PayorProvider(DeptUsers)\SACA\Readmission Analysis\New Process\Template\test.xls;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let xls_dest_30 = E:\XDrive\Payor Provider\PayorProvider(DeptUsers)\SACA\Readmission Analysis\New Process\&amp;amp;year_folder.\&amp;amp;RPTMONTH_30.\&amp;amp;HOSPITAL._READMIT_RPT_&amp;amp;PAID..xls;&lt;/P&gt;&lt;P&gt;%put &amp;amp;xls_dest_30.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;options noxwait;&lt;/P&gt;&lt;P&gt;X copy "&amp;amp;xls_orig_30." "&amp;amp;xls_dest_30.";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%PUT DEFINE NEW TEMPLATE LOCATION;&lt;/P&gt;&lt;P&gt;%LET TEMPLATE = &amp;amp;xls_dest_30.;&lt;/P&gt;&lt;P&gt;%PUT &amp;amp;TEMPLATE.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;* DEFINE TEMPLATE FILE FOR DATA INPUT;&lt;/P&gt;&lt;P&gt;%PUT DEFINE TEMPLATE FILE FOR DATA INPUT;&lt;/P&gt;&lt;P&gt;LIBNAME READMIT EXCEL "&amp;amp;TEMPLATE.";&lt;/P&gt;&lt;P&gt;*RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%PUT DELETE EXISTING DATA;&lt;/P&gt;&lt;P&gt;PROC DATASETS LIB = READMIT noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DELETE DATA2-DATA17;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%PUT DEFINE NEW DATA;&lt;/P&gt;&lt;P&gt;DATA READMIT.DATA2; SET WORK.DATA2b; WHERE SERVICE_provider_id = substr(substr(&amp;amp;HOSPITAL_ID,&lt;STRONG&gt;1&lt;/STRONG&gt;,&lt;STRONG&gt;16&lt;/STRONG&gt;),&lt;STRONG&gt;1&lt;/STRONG&gt;,&lt;STRONG&gt;16&lt;/STRONG&gt;) and system_flag=&amp;amp;flag; drop system_flag; RUN;&lt;/P&gt;&lt;P&gt;DATA READMIT.DATA3; SET WORK.DATA3b_30; WHERE SERVICE_provider_id = substr(&amp;amp;HOSPITAL_ID,&lt;STRONG&gt;1&lt;/STRONG&gt;,&lt;STRONG&gt;16&lt;/STRONG&gt;) and system_flag=&amp;amp;flag; drop system_flag; RUN;&lt;/P&gt;&lt;P&gt;DATA READMIT.DATA4; SET WORK.DATA4b_30; WHERE SERVICE_provider_id = substr(&amp;amp;HOSPITAL_ID,&lt;STRONG&gt;1&lt;/STRONG&gt;,&lt;STRONG&gt;16&lt;/STRONG&gt;) and system_flag=&amp;amp;flag; drop system_flag; RUN;&lt;/P&gt;&lt;P&gt;DATA READMIT.DATA5; SET WORK.DATA5b_30; WHERE SERVICE_provider_id = substr(&amp;amp;HOSPITAL_ID,&lt;STRONG&gt;1&lt;/STRONG&gt;,&lt;STRONG&gt;16&lt;/STRONG&gt;) and system_flag=&amp;amp;flag; drop system_flag; RUN;&lt;/P&gt;&lt;P&gt;DATA READMIT.DATA6; SET WORK.DATA6b_30; WHERE SERVICE_provider_id = substr(&amp;amp;HOSPITAL_ID,&lt;STRONG&gt;1&lt;/STRONG&gt;,&lt;STRONG&gt;16&lt;/STRONG&gt;) and system_flag=&amp;amp;flag; drop system_flag; RUN;&lt;/P&gt;&lt;P&gt;DATA READMIT.DATA7; SET WORK.DATA7b_30; WHERE SERVICE_provider_id = substr(&amp;amp;HOSPITAL_ID,&lt;STRONG&gt;1&lt;/STRONG&gt;,&lt;STRONG&gt;16&lt;/STRONG&gt;) and system_flag=&amp;amp;flag; drop system_flag; RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LIBNAME READMIT CLEAR;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%MEND&lt;/STRONG&gt; READMIT_RPT_30;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2024 17:13:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916077#M40993</guid>
      <dc:creator>moorem30</dc:creator>
      <dc:date>2024-02-14T17:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Macro from truncating character variable name when moving to Excel</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916080#M40994</link>
      <description>&lt;P&gt;I am sorry but it is not at all clear what NAME variable you are talking about.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2024 16:13:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916080#M40994</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-02-14T16:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Macro from truncating character variable name when moving to Excel</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916085#M40995</link>
      <description>My apologies, Hospital is the name</description>
      <pubDate>Wed, 14 Feb 2024 16:17:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916085#M40995</guid>
      <dc:creator>moorem30</dc:creator>
      <dc:date>2024-02-14T16:17:21Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Macro from truncating character variable name when moving to Excel</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916087#M40996</link>
      <description>Hospital is the name</description>
      <pubDate>Wed, 14 Feb 2024 16:17:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916087#M40996</guid>
      <dc:creator>moorem30</dc:creator>
      <dc:date>2024-02-14T16:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Macro from truncating character variable name when moving to Excel</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916104#M40997</link>
      <description>And where is the hospital variable? What is the format and length? You've double checked that the variable is not truncated in the source data sets?</description>
      <pubDate>Wed, 14 Feb 2024 16:43:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916104#M40997</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2024-02-14T16:43:11Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Macro from truncating character variable name when moving to Excel</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916105#M40998</link>
      <description>If it's from the file name issue, it's most likely in how you call the macro which is not shown.</description>
      <pubDate>Wed, 14 Feb 2024 16:44:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916105#M40998</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2024-02-14T16:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Macro from truncating character variable name when moving to Excel</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916107#M40999</link>
      <description>&lt;P&gt;This is not a macro issue, so I would remove the macro language from the problem statement.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you run code without&amp;nbsp; a macro like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;LIBNAME READMIT EXCEL " /*path to some excel file*/ ";

DATA READMIT.DATA2; 
   SET WORK.DATA2b;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Does that show the problem? If so, run PROC CONTENTS and PROC FREQ on the Hospital variable in DATA2b, to see if the values are truncated, or there is a format assigned that is truncating values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's easier to debug SAS code than macro code.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2024 16:55:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916107#M40999</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-02-14T16:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Macro from truncating character variable name when moving to Excel</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916193#M41004</link>
      <description>This is showing the text length is 50 but when reading to excel, it shortens the length to less than 50</description>
      <pubDate>Wed, 14 Feb 2024 20:52:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916193#M41004</guid>
      <dc:creator>moorem30</dc:creator>
      <dc:date>2024-02-14T20:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Macro from truncating character variable name when moving to Excel</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916212#M41006</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/463789"&gt;@moorem30&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;This is showing the text length is 50 but when reading to excel, it shortens the length to less than 50&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It is not clear what you mean.&amp;nbsp; The LENGTH of a character variable is the MAXIMUM number of bytes it can hold.&amp;nbsp; But any observations can have values that are shorter then that maximum, it just cannot have more.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you saying that when you WRITE the values into an Excel sheet and look at the values in the Excel sheet that some of them are shorter than 50 bytes? Note that an Excel sheet does not have anything like the concept of the LENGTH of variable.&amp;nbsp; In a Excel sheet each CELL is independent can can hold anything at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there some specific value that is being truncated?&amp;nbsp; So for example does a value like CALIFORNIA in the SAS variable end up as CALI in the Excel sheet?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2024 21:56:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916212#M41006</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-02-14T21:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Macro from truncating character variable name when moving to Excel</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916213#M41007</link>
      <description>&lt;P&gt;You should show an example.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Show a hospital name with the variable that is 50 characters, and the proc contents output that shows the length.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Screenshots are fine in this case.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Often what has happened in these cases is the data was truncated at an earlier point in time and although the length is increased (format increased) the data is still truncated. However, really we're just guessing without seeing the full process.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2024 22:00:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916213#M41007</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2024-02-14T22:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Macro from truncating character variable name when moving to Excel</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916216#M41008</link>
      <description>&lt;P&gt;Can you make a small example that demonstrates the problem, which we could try running?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, I ran this code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;LIBNAME READMIT EXCEL "Q:\junk\myexcel.xls";

data have ;
  var='01234567890123456789012345678901234567890123456789' ;
run ;

DATA READMIT.DATA2; 
   SET have;
RUN;

libname readmit clear ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But it did not truncate the value written to Excel.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since your problem is not resolved, I would recommend you undo marking my the accepted solution.&amp;nbsp; I think there is a button that says "unaccept as solution" or "this is not the solution" or something like that.&amp;nbsp; When you mark a question as correct/accepted, some people will stop reading the thread.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2024 22:49:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916216#M41008</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-02-14T22:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Macro from truncating character variable name when moving to Excel</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916225#M41009</link>
      <description>Yes, when I write the values into Excel, it is shorter than 50 characters. Yes, exactly like the California example</description>
      <pubDate>Thu, 15 Feb 2024 02:57:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916225#M41009</guid>
      <dc:creator>moorem30</dc:creator>
      <dc:date>2024-02-15T02:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Macro from truncating character variable name when moving to Excel</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916232#M41010</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/463789"&gt;@moorem30&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Yes, when I write the values into Excel, it is shorter than 50 characters. Yes, exactly like the California example&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Did you try just telling excel to widen the column?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1707968097345.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/93765i084B385CEC6B42FB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_0-1707968097345.png" alt="Tom_0-1707968097345.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_1-1707968119392.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/93766i2D4889D616995AD2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_1-1707968119392.png" alt="Tom_1-1707968119392.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2024 03:35:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Prevent-truncating-character-variable-name-when-moving-to-Excel/m-p/916232#M41010</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-02-15T03:35:28Z</dc:date>
    </item>
  </channel>
</rss>

