<?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: Macro Error :  Symbolic variable name            . must begin with a letter or underscore. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-Error-Symbolic-variable-name-must-begin-with-a-letter-or/m-p/270170#M53637</link>
    <description>&lt;P&gt;OK, but i would like to do something like that&lt;/P&gt;&lt;P&gt;proc format take the data from dataset with categorized variables by category&amp;nbsp;&lt;/P&gt;&lt;P&gt;var 1 a&amp;lt;2 grp=1&lt;/P&gt;&lt;P&gt;var 2 2&amp;lt;b grp=2&lt;/P&gt;&lt;P&gt;var 3 b&amp;lt;3 grp=3&lt;/P&gt;&lt;P&gt;and then combine it with other dataset that looks like:&lt;/P&gt;&lt;P&gt;var1 var2 var2&amp;nbsp;&lt;/P&gt;&lt;P&gt;and for example under var 2 there you've got var 1 a=0,5, so instead of&lt;/P&gt;&lt;P&gt;var1&lt;/P&gt;&lt;P&gt;0,5&lt;/P&gt;&lt;P&gt;the output dataset would be&lt;/P&gt;&lt;P&gt;var1&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;as the 0,5 fits into grp=1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is it possible to do that with proc format?&lt;/P&gt;</description>
    <pubDate>Thu, 12 May 2016 19:45:37 GMT</pubDate>
    <dc:creator>pavelcik</dc:creator>
    <dc:date>2016-05-12T19:45:37Z</dc:date>
    <item>
      <title>Macro Error :  Symbolic variable name            . must begin with a letter or underscore.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Error-Symbolic-variable-name-must-begin-with-a-letter-or/m-p/269820#M53497</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;we have a huge problem with our code. We want to make a macro to categorize a dataset which looks like&lt;/P&gt;&lt;P&gt;variable with conditions &amp;nbsp; variable &amp;nbsp; group number &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;var 1 &amp;lt;20 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; variable name &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;20&amp;lt;var1&amp;lt;40 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;variable name &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp;&lt;/P&gt;&lt;P&gt;40&amp;lt;var1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;variable name &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;&lt;P&gt;so&amp;nbsp;we&amp;nbsp;would have a dataset like that:&lt;/P&gt;&lt;P&gt;var 1 &amp;lt;20 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;20&amp;lt;var1&amp;lt;40 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp;&lt;/P&gt;&lt;P&gt;40&amp;lt;var1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;&lt;P&gt;to assign the number, which is in grp column to each of conditions based on one variable.&lt;/P&gt;&lt;P&gt;unfortunately, the execution of the code ends with error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference GRP_KAT not resolved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: There were 3 observations read from the data set WYJ.VIN_KAT.&lt;/P&gt;&lt;P&gt;NOTE: The data set WYJ.VIN_KAT has 3 observations and 212 variables.&lt;/P&gt;&lt;P&gt;NOTE: Compressing data set WYJ.VIN_KAT increased size by 50.00 percent.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Compressed is 3 pages; un-compressed would require 2 pages.&lt;/P&gt;&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; real time &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.04 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; cpu time&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.01 seconds&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;NOTE: Numeric values have been converted to character values at the places given by:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; (Line):(Column).&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 697:187 &amp;nbsp; 697:196&lt;/P&gt;&lt;P&gt;ERROR: Symbolic variable name&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; . must begin with a letter or underscore.&lt;/P&gt;&lt;P&gt;NOTE: Invalid argument to function SYMPUT at line 697 column 180.&lt;/P&gt;&lt;P&gt;war=not missing(ACT_CALL_ACP) and ACT_CALL_ACP &amp;lt;= 1 zmienna=ACT_CALL_ACP grp=1 id=233 grp_kat=.&lt;/P&gt;&lt;P&gt;_ERROR_=1 _N_=1&lt;/P&gt;&lt;P&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/P&gt;&lt;P&gt;NOTE: There were 1 observations read from the data set WYJ.PODZIALY_INT_NIEM_ID.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; WHERE id=233;&lt;/P&gt;&lt;P&gt;WARNING: The data set WORK.TYMCZASOWE_OBIEGI may be incomplete.&amp;nbsp; When this step was stopped there&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; were 1 observations and 5 variables.&lt;/P&gt;&lt;P&gt;NOTE: Compressing data set WORK.TYMCZASOWE_OBIEGI increased size by 100.00 percent.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Compressed is 2 pages; un-compressed would require 1 pages.&lt;/P&gt;&lt;P&gt;WARNING: Data set WORK.TYMCZASOWE_OBIEGI was not replaced because this step was stopped.&lt;/P&gt;&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; real time &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.03 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; cpu time&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.01 seconds&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;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro dane_kat;
%do i=1 %to 243;
	data tymczasowe_obiegi;
		set wyj.podzialy_int_niem_id  (where=(id=&amp;amp;i));
		call symput("war_kat", war);
		call symput("zmienna_kat", zmienna);
		call symput(grp_kat, grp);
	run;

	data &amp;amp;zb._kat;
		set &amp;amp;zb._kat;
		if &amp;amp;war_kat then put &amp;amp;zmienna_kat = &amp;amp;grp_kat;
	run;
%end;
%mend dane_kat;
%dane_kat;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Can you help us with that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12532i141714269D116DB6/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Zrzut ekranu 2016-05-11 o 19.32.44.png" title="Zrzut ekranu 2016-05-11 o 19.32.44.png" /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12533i0EA012A2C78E154F/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="howitshouldbe.png" title="howitshouldbe.png" /&gt;</description>
      <pubDate>Wed, 11 May 2016 17:37:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Error-Symbolic-variable-name-must-begin-with-a-letter-or/m-p/269820#M53497</guid>
      <dc:creator>pavelcik</dc:creator>
      <dc:date>2016-05-11T17:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Error :  Symbolic variable name            . must begin with a letter or underscore.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Error-Symbolic-variable-name-must-begin-with-a-letter-or/m-p/269823#M53499</link>
      <description>&lt;P&gt;There are many issues you will encounter before you come across a solution.&amp;nbsp; To get by the first error, note that you forgot the quotes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;call &lt;SPAN class="token function"&gt;symput&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;("&lt;/SPAN&gt;grp_kat"&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; grp&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would recommend that you reduce the loops (go from 1 to 2, instead of 1 to 243).&amp;nbsp; Note what you hope the generated SAS program will look like, then compare that to what you actually get.&amp;nbsp; To be able to see what you actually get, add this at the top of your program:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;options MPRINT;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But expect that getting this to work will be a multi-step debugging process and this is only the first step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 17:44:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Error-Symbolic-variable-name-must-begin-with-a-letter-or/m-p/269823#M53499</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-05-11T17:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Error :  Symbolic variable name            . must begin with a letter or underscore.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Error-Symbolic-variable-name-must-begin-with-a-letter-or/m-p/269849#M53507</link>
      <description>&lt;P&gt;So it sounds like you're trying to build rules for categorizing data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc Format is designed for this and has a structure that's flexible, maybe you can consider using that instead?&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 18:58:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Error-Symbolic-variable-name-must-begin-with-a-letter-or/m-p/269849#M53507</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-11T18:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Error :  Symbolic variable name            . must begin with a letter or underscore.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Error-Symbolic-variable-name-must-begin-with-a-letter-or/m-p/269863#M53512</link>
      <description>&lt;P&gt;I am guessing that what you are attempting to do is to use the example data set to write some that would look something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set new;
   if var &amp;lt;30 then var_cat = 1;
   if 30 le var &amp;lt; 50 then var_cat= 2;
   if 50 le var then var_cat = 3;

   if var2 &amp;lt;3 then var2_cat = 1;
   if 3 le var2 &amp;lt; 5 then var2_cat= 2;
   if 5 le var2 then var2_cat = 3;

/* repeat for multiple variables*/
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If so, then this may do some of what you want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Replace "Have" with your starting data set and "Want" with a new output set.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   set wyj.podzialy_int_niem_id end=LastRecord; /* data set with conditions*/
   Length Lstr $ 200 tstr $ 32;
   If _n_ = 1 then call execute ("Data want; set have;");
   Else if LastRecord then call execute("run;");
   Else do;
      tstr = catt(zmienna,'_cat');
      Lstr = catx(' ','if',war,'then',tstr,'=',grp,';');
      call execute(lstr);
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You probably do not actually want to write into the Zmienna variable as you could change the value multiple times unless going to a lot of extra code to add ELSE into the IF lines that will be generated by Lstr.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to see the code without running replace the Call Execute with PUTstatements. You write that to a file with a FILE statement in the Data _null_ and run that file after verifying it looks correct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also,&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 19:48:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Error-Symbolic-variable-name-must-begin-with-a-letter-or/m-p/269863#M53512</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-05-11T19:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Error :  Symbolic variable name            . must begin with a letter or underscore.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Error-Symbolic-variable-name-must-begin-with-a-letter-or/m-p/270170#M53637</link>
      <description>&lt;P&gt;OK, but i would like to do something like that&lt;/P&gt;&lt;P&gt;proc format take the data from dataset with categorized variables by category&amp;nbsp;&lt;/P&gt;&lt;P&gt;var 1 a&amp;lt;2 grp=1&lt;/P&gt;&lt;P&gt;var 2 2&amp;lt;b grp=2&lt;/P&gt;&lt;P&gt;var 3 b&amp;lt;3 grp=3&lt;/P&gt;&lt;P&gt;and then combine it with other dataset that looks like:&lt;/P&gt;&lt;P&gt;var1 var2 var2&amp;nbsp;&lt;/P&gt;&lt;P&gt;and for example under var 2 there you've got var 1 a=0,5, so instead of&lt;/P&gt;&lt;P&gt;var1&lt;/P&gt;&lt;P&gt;0,5&lt;/P&gt;&lt;P&gt;the output dataset would be&lt;/P&gt;&lt;P&gt;var1&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;as the 0,5 fits into grp=1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is it possible to do that with proc format?&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 19:45:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Error-Symbolic-variable-name-must-begin-with-a-letter-or/m-p/270170#M53637</guid>
      <dc:creator>pavelcik</dc:creator>
      <dc:date>2016-05-12T19:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Error :  Symbolic variable name            . must begin with a letter or underscore.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Error-Symbolic-variable-name-must-begin-with-a-letter-or/m-p/270172#M53639</link>
      <description>&lt;P&gt;Can i use datasets in call execute?&lt;BR /&gt;like If _n_ = 1 then call execute ("wyj.wanteddata; wyj.podzialy_int_niem_id;");&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 19:46:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Error-Symbolic-variable-name-must-begin-with-a-letter-or/m-p/270172#M53639</guid>
      <dc:creator>pavelcik</dc:creator>
      <dc:date>2016-05-12T19:46:57Z</dc:date>
    </item>
  </channel>
</rss>

