<?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: Create variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-variable/m-p/815484#M321886</link>
    <description>&lt;P&gt;Since you have given us no data, no definition for any of the macro variables, no example of the macro call with its parameters or a log entry showing what ran, I am afraid there is not much we can do with out more details.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a strong suspicion that for at least some of the values in you Escores macro variable that this line fails because of data type.&lt;/P&gt;
&lt;PRE&gt;score = &amp;amp;escore0.;&lt;/PRE&gt;
&lt;P&gt;If you &amp;amp;escore0. value does not include quotes then it will be treated as the name of a variable. Which almost certainly does not exist at the point this line executes because you have kept only one variable in the source set and renamed it to Gini. If your log shows notes about some oddly named variable you do not recognize as "Unitialized" that is almost certainly what happened.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a strong suspicion as well that if you showed an example of the starting data set and the desired result there is much easier way to accomplish this as it appears that you are basically transposing data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example data should be in form of a data step as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 27 May 2022 19:56:14 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-05-27T19:56:14Z</dc:date>
    <item>
      <title>Create variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-variable/m-p/815479#M321883</link>
      <description>&lt;P&gt;I'm in trouble to create the variable "score" in the table "gini&amp;amp;k.2", because what sas creates is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;gini score BA&lt;/P&gt;
&lt;P&gt;0,2 . .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And what I need:&lt;/P&gt;
&lt;P&gt;gini score&lt;/P&gt;
&lt;P&gt;0,2 BA&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Follows the code:&lt;/P&gt;
&lt;P&gt;%macro ks_gini(perf, escores);&lt;/P&gt;
&lt;P&gt;%do k=1 %to %sysfunc(countw(&amp;amp;escores));&lt;BR /&gt;%let escore0 = %scan(&amp;amp;escores, &amp;amp;k);&lt;/P&gt;
&lt;P&gt;proc sort data = base_filtro (keep= &amp;amp;escore0. &amp;amp;perf.) out=sort_&amp;amp;escore0.;&lt;BR /&gt;by &amp;amp;escore0.;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;/*GINI*/&lt;/P&gt;
&lt;P&gt;proc freq data=sort_&amp;amp;escore0. noprint;&lt;BR /&gt;tables &amp;amp;perf.*&amp;amp;escore0./ measures;&lt;BR /&gt;output out=gini&amp;amp;k. measures;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data gini&amp;amp;k.2;&lt;BR /&gt;set gini&amp;amp;k. (keep= _SMDCR_ rename=(_SMDCR_=gini));&lt;BR /&gt;length score $20;&lt;BR /&gt;score = &amp;amp;escore0.;&lt;BR /&gt;FORMAT gini COMMAX20.3;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc append data=gini&amp;amp;k.2 base=gini;run;&lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;
&lt;P&gt;%mend ks_gini;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 19:37:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-variable/m-p/815479#M321883</guid>
      <dc:creator>Thalitacosta</dc:creator>
      <dc:date>2022-05-27T19:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: Create variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-variable/m-p/815483#M321885</link>
      <description>&lt;P&gt;Please post the complete log using "insert code" button to preserve formatting. Don't forget to activate mprint and symbolgen before executing the macro.&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 19:49:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-variable/m-p/815483#M321885</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-05-27T19:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: Create variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-variable/m-p/815484#M321886</link>
      <description>&lt;P&gt;Since you have given us no data, no definition for any of the macro variables, no example of the macro call with its parameters or a log entry showing what ran, I am afraid there is not much we can do with out more details.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a strong suspicion that for at least some of the values in you Escores macro variable that this line fails because of data type.&lt;/P&gt;
&lt;PRE&gt;score = &amp;amp;escore0.;&lt;/PRE&gt;
&lt;P&gt;If you &amp;amp;escore0. value does not include quotes then it will be treated as the name of a variable. Which almost certainly does not exist at the point this line executes because you have kept only one variable in the source set and renamed it to Gini. If your log shows notes about some oddly named variable you do not recognize as "Unitialized" that is almost certainly what happened.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a strong suspicion as well that if you showed an example of the starting data set and the desired result there is much easier way to accomplish this as it appears that you are basically transposing data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example data should be in form of a data step as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 19:56:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-variable/m-p/815484#M321886</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-05-27T19:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: Create variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-variable/m-p/815487#M321888</link>
      <description>&lt;P&gt;Add the following:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint symbolgen;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Run the macro code again, show the code run, the macro call and the log.&lt;/P&gt;
&lt;P&gt;As posted, hard to tell what you're doing or where it could be going wrong.&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 20:03:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-variable/m-p/815487#M321888</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-05-27T20:03:19Z</dc:date>
    </item>
  </channel>
</rss>

