<?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: NOTE: Invalid argument to function SYMPUT('1','157') at line 28 column 6. in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/NOTE-Invalid-argument-to-function-SYMPUT-1-157-at-line-28-column/m-p/617945#M19152</link>
    <description>&lt;P&gt;If count is a numerical variable then you can put the value in a macro variable 'cohort' by using&lt;/P&gt;
&lt;P&gt;call symput("cohort", count);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
count = 15;
call symputx("cohort", count);
run;
%put &amp;amp;=cohort;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 16 Jan 2020 21:59:41 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2020-01-16T21:59:41Z</dc:date>
    <item>
      <title>NOTE: Invalid argument to function SYMPUT('1','157') at line 28 column 6.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/NOTE-Invalid-argument-to-function-SYMPUT-1-157-at-line-28-column/m-p/617941#M19150</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello,&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to use the following statement to create two macro variables.&amp;nbsp; However it gave me the error. May you please help ? Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: Symbolic variable name 1 must begin with a letter or underscore.&lt;BR /&gt;NOTE: Invalid argument to function SYMPUT(&lt;STRONG&gt;'&lt;FONT color="#FF0000"&gt;1'&lt;/FONT&gt;&lt;/STRONG&gt;,'157') at line 28 column 6.&lt;BR /&gt;cohort=flatiron cnnt=157 _ERROR_=1 _N_=1&lt;BR /&gt;ERROR: Symbolic variable name 2 must begin with a letter or underscore.&lt;BR /&gt;NOTE: Invalid argument to function SYMPUT(&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;'2'&lt;/STRONG&gt;&lt;/FONT&gt;,'157') at line 28 column 6.&lt;BR /&gt;cohort=trial cnnt=157 _ERROR_=1 _N_=2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;set cntt;&lt;BR /&gt;call symput(strip(cohort), strip(count));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;DIV align="left"&gt;&lt;P&gt;Obs cohort count&lt;/P&gt;&lt;P&gt;1 flatiron 157&lt;BR /&gt;2 trial 157&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 16 Jan 2020 21:43:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/NOTE-Invalid-argument-to-function-SYMPUT-1-157-at-line-28-column/m-p/617941#M19150</guid>
      <dc:creator>Ivy</dc:creator>
      <dc:date>2020-01-16T21:43:04Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: Invalid argument to function SYMPUT('1','157') at line 28 column 6.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/NOTE-Invalid-argument-to-function-SYMPUT-1-157-at-line-28-column/m-p/617945#M19152</link>
      <description>&lt;P&gt;If count is a numerical variable then you can put the value in a macro variable 'cohort' by using&lt;/P&gt;
&lt;P&gt;call symput("cohort", count);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
count = 15;
call symputx("cohort", count);
run;
%put &amp;amp;=cohort;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Jan 2020 21:59:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/NOTE-Invalid-argument-to-function-SYMPUT-1-157-at-line-28-column/m-p/617945#M19152</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-01-16T21:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: Invalid argument to function SYMPUT('1','157') at line 28 column 6.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/NOTE-Invalid-argument-to-function-SYMPUT-1-157-at-line-28-column/m-p/617948#M19153</link>
      <description>&lt;P&gt;The error messages do not seem to be related to the code you posted.&lt;/P&gt;
&lt;P&gt;Let's turn your listing into a dataset.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data cntt ;
  input cohort :$32. count ;
cards;
flatiron 157
trial 157
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And then try your code.&lt;/P&gt;
&lt;P&gt;Let's simplify things by using the modern CALL SYMPUTX() function instead of archaic CALL SYMPUT() function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set cntt;
  call symputx(cohort,count);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Works fine.&lt;/P&gt;
&lt;PRE&gt;2156  %put &amp;amp;=flatiron &amp;amp;=trial ;
FLATIRON=157 TRIAL=157
&lt;/PRE&gt;
&lt;P&gt;Perhaps your COHORT variable is actual numeric with a format attached?&amp;nbsp; If so you might want to use the formatted value for the name name of the macro variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set cntt;
  call symputx(vvalue(cohort),count);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 22:11:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/NOTE-Invalid-argument-to-function-SYMPUT-1-157-at-line-28-column/m-p/617948#M19153</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-01-16T22:11:30Z</dc:date>
    </item>
  </channel>
</rss>

