<?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: table macro now fails in SAS 9.3 / convert numeric to char / proc printo in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/table-macro-now-fails-in-SAS-9-3-convert-numeric-to-char-proc/m-p/57620#M12458</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The following test worked for me:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format ;&lt;BR /&gt;value gender&lt;BR /&gt;0='Male'&lt;BR /&gt;1='Female';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data havenum;&lt;BR /&gt;sex=1; date=today();output;&lt;BR /&gt;format sex gender. date date9.;&lt;BR /&gt;run;&lt;BR /&gt;filename table 'c:\temp\table.out' lrecl=120;&lt;BR /&gt;ods listing;&lt;BR /&gt;proc printto print=table new;&lt;BR /&gt;proc print data=havenum;&lt;BR /&gt;run;&lt;BR /&gt;proc printto;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notice that, like DATA _NULL_ suggested, the LISTING destination MUST be turned on before the PRINTTO can write to the PRINT location.&amp;nbsp; The LISTING destination is by default turned off for SAS9.3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The fix for Astounding's comment for detecting versions is to use a %SYSEVALF to surround the expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%if %sysevalf(&amp;amp;sysver &amp;gt; 6.10) %then %do;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Feb 2012 19:36:27 GMT</pubDate>
    <dc:creator>ArtC</dc:creator>
    <dc:date>2012-02-28T19:36:27Z</dc:date>
    <item>
      <title>table macro now fails in SAS 9.3 / convert numeric to char / proc printo</title>
      <link>https://communities.sas.com/t5/SAS-Programming/table-macro-now-fails-in-SAS-9-3-convert-numeric-to-char-proc/m-p/57613#M12451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN&gt;This is a somewhat complex question, and I hope someone in this forum can help me resolve it without filing a query to &lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:support@sas.com"&gt;support@sas.com&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For my book, &lt;EM&gt;Visualzing Categorical Data&lt;/EM&gt;, I wrote a macro, table, to handle common requirements to collapse a frequency table over&lt;/P&gt;&lt;P&gt;some factor(s) and/or to apply sas formats to numeric variables so that they could be labeled appropriately in plots. &lt;/P&gt;&lt;P&gt;This was needed particularly in plots produced using SAS/IML which reads variables as either numeric or character and cannot apply &lt;/P&gt;&lt;P&gt;formats to numeric variables as in SAS procedures.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The macro can be found at&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;doc: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.datavis.ca/sasmac/table.html"&gt;http://www.datavis.ca/sasmac/table.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;source: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.datavis.ca/sas/vcd/macros/table.sas"&gt;http://www.datavis.ca/sas/vcd/macros/table.sas&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've recently been informed by a user of my book that the macro fails to work when the char=Y option is specified under SAS 9.3,&lt;/P&gt;&lt;P&gt;whereas it did work under SAS 9.2.&amp;nbsp; The code I used in the macro to convert numeric variables to character relies on using PROC PRINTTO&lt;/P&gt;&lt;P&gt;to write the formatted data to a temporary file and then read it back in in a separate data step.&amp;nbsp; Something changed between SAS 9.2&lt;/P&gt;&lt;P&gt;and SAS 9.3 regarding PROC PRINTTO, but I haven't been able to figure out what.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But, perhaps there is another way to accomplish what I want-- to convert numeric variables to formatted character variables&lt;/P&gt;&lt;P&gt;in another dataset with the same variable names.&amp;nbsp; When I wrote this macro, the only way to do this I knew of was to use&lt;/P&gt;&lt;P&gt;PROC PRINTTO, but I always thought this was a kludge because you could not change a variable from numeric to character&lt;/P&gt;&lt;P&gt;in a data step. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Demonstration code (using attached data file, berkeley.sas)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*include catdata(berkeley);&lt;/P&gt;&lt;P&gt;%include 'path/to/berkeley.sas';&lt;/P&gt;&lt;P&gt;*include macros(table);&lt;/P&gt;&lt;P&gt;%include 'path/to/table.sas'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*-- Collapse over dept;&lt;/P&gt;&lt;P&gt;%table(data=berkeley, out=berk2, var=Admit Gender, weight=freq,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; char=Y, format=admit admit. gender $sex.,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; order=data);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Log file from SAS 9.2, where it works:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;24&amp;nbsp;&amp;nbsp; *-- Collapse over dept;&lt;/P&gt;&lt;P&gt;25&amp;nbsp;&amp;nbsp; %table(data=berkeley, out=berk2, var=Admit Gender, weight=freq,&lt;/P&gt;&lt;P&gt;26&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; char=Y, format=admit admit. gender $sex.,&lt;/P&gt;&lt;P&gt;27&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; order=data);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: There were 24 observations read from the data set WORK.BERKELEY.&lt;/P&gt;&lt;P&gt;NOTE: The data set WORK.BERK2 has 4 observations and 3 variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: There were 4 observations read from the data set WORK.BERK2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: The infile TABLE is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Filename=c:\temp\table.out,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RECFM=V,LRECL=120,File Size (bytes)=175,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Last Modified=17Feb2012:11:23:59,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Create Time=17Feb2012:11:10:11&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: 8 records were read from the infile TABLE.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The minimum record length was 0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The maximum record length was 27.&lt;/P&gt;&lt;P&gt;NOTE: The data set WORK.BERK2 has 4 observations and 3 variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Log file from SAS 9.3, where it fails:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;80&amp;nbsp;&amp;nbsp;&amp;nbsp; *-- Collapse over dept;&lt;/P&gt;&lt;P&gt;81&amp;nbsp;&amp;nbsp;&amp;nbsp; %table(data=berkeley, out=berk2, var=Admit Gender, weight=freq,&lt;/P&gt;&lt;P&gt;82&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; char=Y, format=admit admit. gender $sex.,&lt;/P&gt;&lt;P&gt;83&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; order=data);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: There were 24 observations read from the data set WORK.BERKELEY.&lt;/P&gt;&lt;P&gt;NOTE: The data set WORK.BERK2 has 4 observations and 3 variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: There were 4 observations read from the data set WORK.BERK2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: The infile TABLE is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Filename=c:\temp\table.out,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RECFM=V,LRECL=120,File Size (bytes)=0,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Last Modified=17Feb2012:11:20:21,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Create Time=17Feb2012:11:10:11&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: 0 records were read from the infile TABLE.&lt;/P&gt;&lt;P&gt;NOTE: The data set WORK.BERK2 has 0 observations and 3 variables.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Feb 2012 18:35:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/table-macro-now-fails-in-SAS-9-3-convert-numeric-to-char-proc/m-p/57613#M12451</guid>
      <dc:creator>michael_friendly</dc:creator>
      <dc:date>2012-02-17T18:35:35Z</dc:date>
    </item>
    <item>
      <title>table macro now fails in SAS 9.3 / convert numeric to char / proc printo</title>
      <link>https://communities.sas.com/t5/SAS-Programming/table-macro-now-fails-in-SAS-9-3-convert-numeric-to-char-proc/m-p/57614#M12452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be more helpful if you would turn on MPRINT.&amp;nbsp; The log would be more meaningful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the meantime, consider that you may need to change this comparison in the future:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%if &amp;amp;sysver &amp;gt; 6.10 %then %do;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because of the decimal point, this will make a character comparison.&amp;nbsp; Once you hit version 10 of SAS, the comparison will be false.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Feb 2012 18:59:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/table-macro-now-fails-in-SAS-9-3-convert-numeric-to-char-proc/m-p/57614#M12452</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-02-17T18:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: table macro now fails in SAS 9.3 / convert numeric to char / proc printo</title>
      <link>https://communities.sas.com/t5/SAS-Programming/table-macro-now-fails-in-SAS-9-3-convert-numeric-to-char-proc/m-p/57615#M12453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could it be as simple as ODS LISTING CLOSE;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To be more specific in this example ODS LISTING is closed but the PRINTTO bits still work in that there are no errors.&amp;nbsp; Just no data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;ods&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;html&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;file&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: purple; font-family: 'Courier New'; background-color: white;"&gt;'test.htm'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;ods&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;listing&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;close&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;filename&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; FT75F001 &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;temp&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;printto&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; new &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;print&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;=FT75F001;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;print&lt;/STRONG&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;=sashelp.class;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;printto&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;_null_&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;infile&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; FT75F001;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;put&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;_infile_&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;ods&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;html&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;close&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With regards to the conversion of numeric to character with format consider using VVALUE or PROC TRANPOSE.&amp;nbsp; I like proc tranpose when I have a lot of variables to convert.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: data _null_&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Feb 2012 19:09:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/table-macro-now-fails-in-SAS-9-3-convert-numeric-to-char-proc/m-p/57615#M12453</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2012-02-17T19:09:08Z</dc:date>
    </item>
    <item>
      <title>table macro now fails in SAS 9.3 / convert numeric to char / proc printo</title>
      <link>https://communities.sas.com/t5/SAS-Programming/table-macro-now-fails-in-SAS-9-3-convert-numeric-to-char-proc/m-p/57616#M12454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; There is a DATA step solution for converting numeric to Character in my macro book chapt 6 question 4.&amp;nbsp; Down load the sample code and look for the answer (search the sample code for :&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;***A1.6.4&lt;/P&gt;&lt;P&gt;***%ALLCHAR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Feb 2012 20:05:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/table-macro-now-fails-in-SAS-9-3-convert-numeric-to-char-proc/m-p/57616#M12454</guid>
      <dc:creator>ArtC</dc:creator>
      <dc:date>2012-02-17T20:05:54Z</dc:date>
    </item>
    <item>
      <title>table macro now fails in SAS 9.3 / convert numeric to char / proc printo</title>
      <link>https://communities.sas.com/t5/SAS-Programming/table-macro-now-fails-in-SAS-9-3-convert-numeric-to-char-proc/m-p/57617#M12455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I haven't been able to make any progress on this problem.&amp;nbsp; Something has changed with PROC PRINTO in version 9.3,&lt;/P&gt;&lt;P&gt;such that my use of this method to convert selected numeric variables to character no longer works.&amp;nbsp; Below is a log file&lt;/P&gt;&lt;P&gt;using the same macro (except that I changed the &lt;/P&gt;&lt;P&gt;%if &amp;amp;sysver &amp;gt; 6.10 %then %do; to %if &amp;amp;sysver &amp;gt;=7 %then %do;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems that the line in the macro,&lt;/P&gt;&lt;P&gt;proc printto new print=table;&lt;/P&gt;&lt;P&gt;does not create the file with the formatted values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The suggestion by data_null_ to use ODS LISTING CLOSE didn't work either.&amp;nbsp; By default, in SAS 9.3 (Win XP), &lt;/P&gt;&lt;P&gt;ODS LISTING is off anyway.&amp;nbsp; To me, this seems like a bug in PROC PRINTTO under SAS 9.3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp; %include catdata(berkeley);&lt;/P&gt;&lt;P&gt;NOTE: Format ADMIT has been output.&lt;/P&gt;&lt;P&gt;NOTE: Format YN has been output.&lt;/P&gt;&lt;P&gt;NOTE: Format DEPT has been output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: SAS went to a new line when INPUT statement reached past the end of a&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; line.&lt;/P&gt;&lt;P&gt;NOTE: The data set WORK.BERKELEY has 24 observations and 4 variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;23&lt;/P&gt;&lt;P&gt;24&amp;nbsp;&amp;nbsp; options mprint;&lt;/P&gt;&lt;P&gt;25&amp;nbsp;&amp;nbsp; *-- Collapse over dept;&lt;/P&gt;&lt;P&gt;26&amp;nbsp;&amp;nbsp; %table(data=berkeley, out=berk2, var=Admit Gender, weight=freq,&lt;/P&gt;&lt;P&gt;27&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; char=Y, format=admit admit. gender $sex.,&lt;/P&gt;&lt;P&gt;28&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; order=data);&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; proc freq data=berkeley order=data ;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; weight freq;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; tables Admit * Gender / noprint sparse out=berk2(drop=percent);&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; format admit admit. gender $sex.;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: Writing HTML Body file: sashtml.htm&lt;/P&gt;&lt;P&gt;NOTE: There were 24 observations read from the data set WORK.BERKELEY.&lt;/P&gt;&lt;P&gt;NOTE: The data set WORK.BERK2 has 4 observations and 3 variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MPRINT(TEMPFILE):&amp;nbsp;&amp;nbsp; filename table "c:\temp\table.out" lrecl=120;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; proc printto new print=table;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; options nodate nocenter nonumber ls=120 ps=10000;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; proc print data=berk2;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; id Admit Gender;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; var count;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: There were 4 observations read from the data set WORK.BERK2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; proc printto print=print;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; data berk2;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; infile table length=len;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; length string $120 Admit Gender $16;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; retain skipping 1;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; drop string skipping;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; input @1 string $varying. len @;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; if skipping=0 &amp;amp; string ^= ' ' then do;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; input @1 Admit $ Gender $ count;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; else input;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; if index(string,'COUNT')&amp;gt;0 then skipping=0;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: The infile TABLE is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Filename=c:\temp\table.out,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RECFM=V,LRECL=120,File Size (bytes)=0,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Last Modified=28Feb2012:12:15:49,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Create Time=17Feb2012:11:10:11&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: 0 records were read from the infile TABLE.&lt;/P&gt;&lt;P&gt;NOTE: The data set WORK.BERK2 has 0 observations and 3 variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; *proc contents data=&amp;amp;out;&lt;/P&gt;&lt;P&gt;MPRINT(TEMPDEL):&amp;nbsp;&amp;nbsp; *-- Avoid annoying flash with X commands;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;MPRINT(TABLE):&amp;nbsp;&amp;nbsp; options notes LS=80 PS=60 DATE CENTER;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 18:14:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/table-macro-now-fails-in-SAS-9-3-convert-numeric-to-char-proc/m-p/57617#M12455</guid>
      <dc:creator>michael_friendly</dc:creator>
      <dc:date>2012-02-28T18:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: table macro now fails in SAS 9.3 / convert numeric to char / proc printo</title>
      <link>https://communities.sas.com/t5/SAS-Programming/table-macro-now-fails-in-SAS-9-3-convert-numeric-to-char-proc/m-p/57618#M12456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My suggestion was that ODS LISTING was already closed and that it should be turned on.&amp;nbsp; ODS LISTING;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My example was to show the with it CLOSEd there would be no ERROR just as you reported.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another approach would be to use ODS LISTING FILE=...; in place of PROC PRINTTO.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 18:31:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/table-macro-now-fails-in-SAS-9-3-convert-numeric-to-char-proc/m-p/57618#M12456</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2012-02-28T18:31:36Z</dc:date>
    </item>
    <item>
      <title>table macro now fails in SAS 9.3 / convert numeric to char / proc printo</title>
      <link>https://communities.sas.com/t5/SAS-Programming/table-macro-now-fails-in-SAS-9-3-convert-numeric-to-char-proc/m-p/57619#M12457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Help us out here.&amp;nbsp; When this program finishes, what is in c:\temp\table.out?&amp;nbsp; Is it actually empty?&amp;nbsp; If you apply data_null_;'s suggestion, does that change?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also note, changing the &amp;amp;sysver comparison to 7 may not be enough to overcome the decimal point problem.&amp;nbsp; It is possible that &amp;amp;sysver will contain a decimal point.&amp;nbsp; In macro language, this is still a character comparison and will be false:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%if 10.0 &amp;gt; 7 %then %do;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It might be easier just to remove the %IF comparison, and add a comment about what to change if you are using an archaic version of SAS.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 18:42:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/table-macro-now-fails-in-SAS-9-3-convert-numeric-to-char-proc/m-p/57619#M12457</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-02-28T18:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: table macro now fails in SAS 9.3 / convert numeric to char / proc printo</title>
      <link>https://communities.sas.com/t5/SAS-Programming/table-macro-now-fails-in-SAS-9-3-convert-numeric-to-char-proc/m-p/57620#M12458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The following test worked for me:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format ;&lt;BR /&gt;value gender&lt;BR /&gt;0='Male'&lt;BR /&gt;1='Female';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data havenum;&lt;BR /&gt;sex=1; date=today();output;&lt;BR /&gt;format sex gender. date date9.;&lt;BR /&gt;run;&lt;BR /&gt;filename table 'c:\temp\table.out' lrecl=120;&lt;BR /&gt;ods listing;&lt;BR /&gt;proc printto print=table new;&lt;BR /&gt;proc print data=havenum;&lt;BR /&gt;run;&lt;BR /&gt;proc printto;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notice that, like DATA _NULL_ suggested, the LISTING destination MUST be turned on before the PRINTTO can write to the PRINT location.&amp;nbsp; The LISTING destination is by default turned off for SAS9.3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The fix for Astounding's comment for detecting versions is to use a %SYSEVALF to surround the expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%if %sysevalf(&amp;amp;sysver &amp;gt; 6.10) %then %do;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 19:36:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/table-macro-now-fails-in-SAS-9-3-convert-numeric-to-char-proc/m-p/57620#M12458</guid>
      <dc:creator>ArtC</dc:creator>
      <dc:date>2012-02-28T19:36:27Z</dc:date>
    </item>
  </channel>
</rss>

