<?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: call symput in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/call-symput/m-p/904253#M357278</link>
    <description>&lt;P&gt;The step will store the last value of the variable CHECK read from the dataset CHECK into the macro variable named CHECK.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that along the way it will also store all of the other values of CHECK into the macro variable, but they will be replaced by the value written later.&amp;nbsp; So only the value from the last observation will be available after the data step ends.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;NOTE: You almost never want to use the ancient CALL SYMPUT() method.&lt;/STRONG&gt;&amp;nbsp; Instead use the modern (its only been available for about 30 years) CALL SYMPUTX() method instead.&amp;nbsp; The only reason to use CALL SYMPUT() is if you really need to have leading and/or trailing spaces written into the macro variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Nov 2023 16:14:37 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2023-11-22T16:14:37Z</dc:date>
    <item>
      <title>call symput</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-symput/m-p/904239#M357270</link>
      <description>&lt;P&gt;CHECK dataset created before , but why below bolded step for&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data _NULL_;&lt;BR /&gt;set CHECK;&lt;BR /&gt;&lt;STRONG&gt;call symput ('CHECK',CHECK);&lt;/STRONG&gt;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 15:15:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-symput/m-p/904239#M357270</guid>
      <dc:creator>soujik</dc:creator>
      <dc:date>2023-11-22T15:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: call symput</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-symput/m-p/904240#M357271</link>
      <description>&lt;P&gt;This bolded step creates a macro variable named CHECK that contains the value of the data set variable named CHECK.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can have the value of the macro variable CHECK written to the log by running this line of code after the data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put &amp;amp;=check;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 15:30:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-symput/m-p/904240#M357271</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-11-22T15:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: call symput</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-symput/m-p/904241#M357272</link>
      <description>&lt;P&gt;Hey, thank you... you mean like below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;data _NULL_;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;set CHECK;&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;call symput ('CHECK',CHECK);&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%put &amp;amp; = check;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 15:32:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-symput/m-p/904241#M357272</guid>
      <dc:creator>soujik</dc:creator>
      <dc:date>2023-11-22T15:32:21Z</dc:date>
    </item>
    <item>
      <title>Re: call symput</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-symput/m-p/904243#M357273</link>
      <description>&lt;P&gt;You seem to have put spaces before and after the equal sign in the %put statement, which is not correct.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 15:40:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-symput/m-p/904243#M357273</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-11-22T15:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: call symput</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-symput/m-p/904247#M357274</link>
      <description>&lt;P&gt;thank you I got some number(xxxxx), but i want this number in date format (like 22NOV2023)&lt;/P&gt;&lt;P&gt;in log I see CHECK= XXXXX&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 15:49:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-symput/m-p/904247#M357274</guid>
      <dc:creator>soujik</dc:creator>
      <dc:date>2023-11-22T15:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: call symput</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-symput/m-p/904248#M357275</link>
      <description>&lt;P&gt;More explanation is needed. What are you going to do with this macro variable CHECK?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 15:50:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-symput/m-p/904248#M357275</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-11-22T15:50:49Z</dc:date>
    </item>
    <item>
      <title>Re: call symput</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-symput/m-p/904249#M357276</link>
      <description>&lt;P&gt;I want to see variable value in log&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 15:55:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-symput/m-p/904249#M357276</guid>
      <dc:creator>soujik</dc:creator>
      <dc:date>2023-11-22T15:55:38Z</dc:date>
    </item>
    <item>
      <title>Re: call symput</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-symput/m-p/904252#M357277</link>
      <description>&lt;P&gt;The %PUT statement shows you the value of the variable. Please be generous with information ... please explain more about what you are going to do with the macro variable &amp;amp;CHECK. Please explain, in detail, what happens with this macro variable after this in your code. Please don't make me ask repeatedly for more information.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 16:04:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-symput/m-p/904252#M357277</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-11-22T16:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: call symput</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-symput/m-p/904253#M357278</link>
      <description>&lt;P&gt;The step will store the last value of the variable CHECK read from the dataset CHECK into the macro variable named CHECK.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that along the way it will also store all of the other values of CHECK into the macro variable, but they will be replaced by the value written later.&amp;nbsp; So only the value from the last observation will be available after the data step ends.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;NOTE: You almost never want to use the ancient CALL SYMPUT() method.&lt;/STRONG&gt;&amp;nbsp; Instead use the modern (its only been available for about 30 years) CALL SYMPUTX() method instead.&amp;nbsp; The only reason to use CALL SYMPUT() is if you really need to have leading and/or trailing spaces written into the macro variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 16:14:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-symput/m-p/904253#M357278</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-11-22T16:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: call symput</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-symput/m-p/904254#M357279</link>
      <description>&lt;P&gt;The number used to store the date '&lt;SPAN&gt;22NOV2023'd is 23,336.&amp;nbsp; So having a value like 23336 in the macro variable means you can use it to compare to other date values.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Example:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;3179  data _null_;
3180    date='22NOV2023'd;
3181    put date=;
3182    call symput('date1',date);
3183    call symputX('date2',date);
3184  run;

NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
      3182:23
date=23336
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


3185
3186  %put &amp;amp;=date1 &amp;amp;=date2;
DATE1=       23336 DATE2=23336
&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;Notice how using the ancient CALL SYMPUT() method generates extra leading spaces in the macro variable and also ugly notes in the SAS log about converting numbers to characters.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you would like the string 22NOV2023 written into the macro variable then tell SAS to convert the date using the DATE9. format.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set check;
  call symputx('check',put(check,date9.));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;But note that if you wanted to use &amp;amp;CHECK to compare to other date values you will need to add quotes and the letter d.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where mydate &amp;lt;= "&amp;amp;check"d &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Nov 2023 16:23:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-symput/m-p/904254#M357279</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-11-22T16:23:45Z</dc:date>
    </item>
  </channel>
</rss>

