<?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 CALL SYMPUT vs CALL SYMPUTX in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/377866#M90755</link>
    <description>&lt;P&gt;I keep reading conflicting info. &amp;nbsp;Does CALL SYMPUTX automatically convert the value assigned to the macro variable to character (assuming it is numeric) or is the numeric format preserved?&lt;/P&gt;</description>
    <pubDate>Thu, 20 Jul 2017 18:13:21 GMT</pubDate>
    <dc:creator>GreggB</dc:creator>
    <dc:date>2017-07-20T18:13:21Z</dc:date>
    <item>
      <title>CALL SYMPUT vs CALL SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/377866#M90755</link>
      <description>&lt;P&gt;I keep reading conflicting info. &amp;nbsp;Does CALL SYMPUTX automatically convert the value assigned to the macro variable to character (assuming it is numeric) or is the numeric format preserved?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2017 18:13:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/377866#M90755</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2017-07-20T18:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT vs CALL SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/377870#M90756</link>
      <description>&lt;P&gt;Both SYMPUT and SYMPUTX convert the value to character before assigning to a macro variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SYMPUT gives you a message on the log about the conversion, while SYMPUTX does not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SYMPUTX takes the additional step of removing any leading blanks that were caused by the conversion.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2017 18:19:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/377870#M90756</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-07-20T18:19:47Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT vs CALL SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/377874#M90759</link>
      <description>&lt;P&gt;I assume you are asking about the DATA step? You can &lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#n1nexcs36ctqk5n11uao7k9myz7y.htm" target="_self"&gt;read about the differences between SYMPUT and SYMPUTX in the SAS doc.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000780416.htm#a001304598" target="_self"&gt;According to the SAS documentation,&amp;nbsp;&lt;/A&gt;&amp;nbsp;the DATA step will use BEST12. to convert the numeric value to a character value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not every SAS language does an automatic conversion, so SYMPUTX is more robust. See:&amp;nbsp;&lt;A href="http://blogs.sas.com/content/iml/2011/10/17/does-symput-work-in-iml.html" target="_blank"&gt;http://blogs.sas.com/content/iml/2011/10/17/does-symput-work-in-iml.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2017 18:24:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/377874#M90759</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-07-20T18:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT vs CALL SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/377876#M90760</link>
      <description>&lt;P&gt;yes, in the DATA step.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2017 18:25:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/377876#M90760</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2017-07-20T18:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT vs CALL SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/377977#M90797</link>
      <description>&lt;P&gt;CALL SYMPUT() and CALL SYMPUTX() will convert numbers to text using BEST12. format.&lt;/P&gt;
&lt;P&gt;If you want to preserve the format attached to a number then either convert it to character yourself or use the VVALUE() (or VVALUEX()) function to get the formatted value.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  x=123456.890123456;
  format x dollar12.2 ;
  call symputx('v1',x);
  call symputx('v2',put(x,best32.));
  call symputx('v3',vvalue(x));
  dt=date();
  format dt yymmdd10.;
  call symputx('d1',dt);
  call symputx('d2',put(dt,date9.));
  call symputx('d3',vvalue(dt));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;26  %put &amp;amp;=v1 &amp;amp;=v2 &amp;amp;=v3 &amp;amp;=d1 &amp;amp;=d2 &amp;amp;=d3;
V1=123456.89012 V2=123456.890123456 V3=$123,456.89 D1=21020 D2=20JUL2017 D3=2017-07-20
&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Jul 2017 03:20:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/377977#M90797</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-07-21T03:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT vs CALL SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/511986#M137837</link>
      <description>&lt;P&gt;Rick,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Methinks the part of the SAS doc you've cited re: automatic type conversion is relevant only to the particular situation described there, i.e. "&lt;SPAN&gt;If you specify a variable in an expression, but the variable value does not match the type called for". This appears not to be the case with SYMPUTX (nor with CAT*), and so using BEST12. for the conversion doesn't apply to them. Consider:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_ ;                          
  call symputx ("x", 123456789012345) ;
run ;                                  
%put &amp;amp;=x ;                             
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;which prints in the log:&amp;nbsp;&lt;/SPAN&gt;&lt;CODE class=" language-sas"&gt;X=123456789012345.&lt;/CODE&gt;&lt;SPAN&gt;If BEST12. were used, we would see&amp;nbsp;&lt;/SPAN&gt;&lt;CODE class=" language-sas"&gt;X=1.2345679E14&amp;nbsp;&lt;/CODE&gt;&lt;SPAN&gt;instead. The docs for SYMPUTX and CAT* give no explicit indication as to which format is used internally; yet I recall Rick L telling me in Denver it's 32. At any rate, it's obviously longer than 12.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Paul D.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Nov 2018 03:57:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/511986#M137837</guid>
      <dc:creator>hashman</dc:creator>
      <dc:date>2018-11-11T03:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT vs CALL SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/512008#M137850</link>
      <description>&lt;P&gt;Thanks. Another reason to favor CALL SYMPUTX() over the older CALL SYMPUT().&lt;/P&gt;</description>
      <pubDate>Sun, 11 Nov 2018 16:10:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/512008#M137850</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-11-11T16:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT vs CALL SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/512029#M137866</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;: Agreed. The auto-stripping of the leading/trailing blanks doesn't hurt, either.&lt;/P&gt;</description>
      <pubDate>Sun, 11 Nov 2018 19:56:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/512029#M137866</guid>
      <dc:creator>hashman</dc:creator>
      <dc:date>2018-11-11T19:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT vs CALL SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/533511#M146281</link>
      <description>&lt;P&gt;SAS will never say SYMPUT is deprecated.&amp;nbsp; After all, that 40+ year old code still needs to work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yet IMO SYMPUT is deprecated.&amp;nbsp; I can't think of any reason to use it over SYMPUTX.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Feb 2019 05:22:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/533511#M146281</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-02-07T05:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT vs CALL SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/533580#M146310</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15043"&gt;@ScottBass&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;SAS will never say SYMPUT is deprecated.&amp;nbsp; After all, that 40+ year old code still needs to work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yet IMO SYMPUT is deprecated.&amp;nbsp; I can't think of any reason to use it over SYMPUTX.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The main use case is when you want to store the leading/trailing spaces into the macro variable.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   set metadata ;
   call symput('left',put(chapter,$20.));
   call symput('middle',put(title,$40.-c));
   call symput('right',put(catx(' ','Page',pageno),$20.-R));
run;
title "&amp;amp;left.&amp;amp;middle.&amp;amp;right";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Feb 2019 13:49:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/533580#M146310</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-02-07T13:49:50Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT vs CALL SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/554645#M154322</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;&lt;EM&gt;&amp;nbsp;&amp;gt;CALL SYMPUT() and CALL SYMPUTX() will convert numbers to text using BEST12. format.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Only decimal numbers use format best12., integer precision seems better conserved by symputx() as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/21262"&gt;@hashman&lt;/a&gt;&amp;nbsp; pointed out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  INT=1234567890123456;
  format INT dollar22.0 ;
  call symput ('i1',INT);
  call symputx('i2',INT);
  call symputx('i3',put(INT,best12.));
  call symputx('i4',put(INT,best32.));
  call symputx('i5',vvalue(INT));
  DEC=123456.890123456;
  format DEC dollar12.2 ;
  call symput ('f1',DEC);
  call symputx('f2',DEC);
  call symputx('f3',put(DEC,best12.));
  call symputx('f4',put(DEC,best32.));
  call symputx('f5',vvalue(DEC));
  DTE=date();
  format DTE yymmdd10.;
  call symput ('d1',DTE);
  call symputx('d2',DTE);
  call symputx('d3',put(DTE,date9.));
  call symputx('d4',vvalue(DTE));
run;
%put INT Symput         &amp;amp;i1;
%put INT Symputx        &amp;amp;i2;
%put INT Symputx best12 &amp;amp;i3;
%put INT Symputx best32 &amp;amp;i4;
%put INT Symputx vvalue &amp;amp;i5;
%put DEC Symput         &amp;amp;f1;
%put DEC Symputx        &amp;amp;f2;
%put DEC Symputx best12 &amp;amp;f3;
%put DEC Symputx best32 &amp;amp;f4;
%put DEC Symputx vvalue &amp;amp;f5;
%put DTE Symput         &amp;amp;d1;
%put DTE Symputx        &amp;amp;d2;
%put DTE Symputx date9  &amp;amp;d3;
%put DTE Symputx vvalue &amp;amp;d4;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;INT Symput         1.2345679E15
INT Symputx        1234567890123456
INT Symputx best12 1.2345679E15
INT Symputx best32 1234567890123456
INT Symputx vvalue $1,234,567,890,123,456&lt;BR /&gt;
DEC Symput         123456.89012
DEC Symputx        123456.89012
DEC Symputx best12 123456.89012
DEC Symputx best32 123456.890123456
DEC Symputx vvalue $123,456.89&lt;BR /&gt;
DTE Symput                21668
DTE Symputx        21668
DTE Symputx date9  29APR2019
DTE Symputx vvalue 2019-04-29&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2019 04:11:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/554645#M154322</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-04-29T04:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT vs CALL SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/554677#M154336</link>
      <description>CALL SYMPUTX() uses BEST32. instead of BEST12.&lt;BR /&gt;</description>
      <pubDate>Mon, 29 Apr 2019 12:36:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/554677#M154336</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-04-29T12:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT vs CALL SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/554871#M154391</link>
      <description>&lt;P&gt;&lt;EM&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;gt; CALL SYMPUTX() uses BEST32. instead of BEST12.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No it doesn't necessarily do that. That's the point I am making.&lt;/P&gt;
&lt;P&gt;It uses best12. for (some?) decimal numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  INT=1234567890123456;
  put INT= best32. INT= best12.;
  call symputx('int',INT);
run;
%put &amp;amp;=int ;&lt;BR /&gt;
data _null_;
  DEC=123456789.123456;
  put DEC= best32. DEC= best12.;
  call symputx('dec',DEC);
run;
%put &amp;amp;=dec;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;INT=1234567890123456 INT=1.2345679E15&lt;BR /&gt;INT=1234567890123456&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DEC=123456789.123456 DEC=123456789.12&lt;BR /&gt;DEC=123456789.12&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2019 21:58:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/554871#M154391</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-04-29T21:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT vs CALL SYMPUTX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/554880#M154398</link>
      <description>&lt;P&gt;It does seem to only use the longer width for integers (or values that are close enough to an integer that the decimal part wouldn't print anyway).&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2019 23:16:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-vs-CALL-SYMPUTX/m-p/554880#M154398</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-04-29T23:16:57Z</dc:date>
    </item>
  </channel>
</rss>

