<?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: How do i substitute my variables and my file in this code in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-do-i-substitute-my-variables-and-my-file-in-this-code/m-p/844810#M36728</link>
    <description>Hi, thanks for answer. I understand a little of the code, and the person who provided it to me cannot explain</description>
    <pubDate>Thu, 17 Nov 2022 12:24:57 GMT</pubDate>
    <dc:creator>ari2495</dc:creator>
    <dc:date>2022-11-17T12:24:57Z</dc:date>
    <item>
      <title>How do i substitute my variables and my file in this code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-i-substitute-my-variables-and-my-file-in-this-code/m-p/844800#M36723</link>
      <description>&lt;P&gt;Hi, I got this code to apply to my dataset and to substitute with my variables. there is a macro, that I do not know how to use. I would be very thankful if you could tell me where to substitute my variables (I neither have the dateset where this code worked, so i cannot compare to understand).&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%macro AUC_test (input= , pd_est= , default_flag= , Segmento= );

data campione_&amp;amp;segmento.;
set &amp;amp;input.;
*where MOD_RATING_ALLA_DATA_RIF= "&amp;amp;segmento.";
run;
/* AUC calculation */
	proc freq data = campione_&amp;amp;segmento. noprint;
	table &amp;amp;pd_est. * &amp;amp;default_flag.   / missing measures;
	output out=_smd measures;
	run;

	data _smd_&amp;amp;pd_est._&amp;amp;segmento.;
	set _smd (keep = _smdrc_ e_smdrc n);
	format AUC 17.15;
	format Esito $6.;
	AUC = (_smdrc_ + 1)/2;
	if AUC&amp;lt;= 0.65 then Esito= "ROSSO";
	else if 0.65&amp;lt;AUC&amp;lt;= 0.8 then Esito= "GIALLO";
	else if AUC&amp;gt;0.8 then Esito= "VERDE";
	Segmento="&amp;amp;segmento.";
	run;

%mend;

/*BASE*/
%AUC_test (input = Discr  , pd_est = PD0Base , default_flag = flag_default_finale, Segmento= IMP );
%AUC_test (input = Discr  , pd_est = PD0Base , default_flag = flag_default_finale, Segmento= POE );
%AUC_test (input = Discr  , pd_est = PD0Base , default_flag = flag_default_finale, Segmento= PRI );
%AUC_test (input = Discr  , pd_est = PD0Base , default_flag = flag_default_finale, Segmento= SMB );
/*WEIGHTED*/
%AUC_test (input = Discr  , pd_est = PD_weighted , default_flag = flag_default_finale, Segmento= IMP );
%AUC_test (input = Discr  , pd_est = PD_weighted , default_flag = flag_default_finale, Segmento= POE );
%AUC_test (input = Discr  , pd_est = PD_weighted , default_flag = flag_default_finale, Segmento= PRI );
%AUC_test (input = Discr  , pd_est = PD_weighted , default_flag = flag_default_finale, Segmento= SMB );

data AUC_Base;
set _smd_pd0base_imp _smd_pd0base_poe _smd_pd0base_pri _smd_pd0base_smb;
run;
data AUC_Weighted;
set _smd_pd_weighted_imp _smd_pd_weighted_poe _smd_pd_weighted_pri _smd_pd_weighted_smb;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Nov 2022 11:52:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-i-substitute-my-variables-and-my-file-in-this-code/m-p/844800#M36723</guid>
      <dc:creator>ari2495</dc:creator>
      <dc:date>2022-11-17T11:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do i substitute my variables and my file in this code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-i-substitute-my-variables-and-my-file-in-this-code/m-p/844807#M36726</link>
      <description>&lt;P&gt;Hello!&lt;BR /&gt;Hugh ... long answer. First off ... the code seems to be intended to run as is, i.e. the macro is defined _and_ used there.&lt;BR /&gt;The adaption to your tables is done in the /* BASE */ and /* WEIGHTED */ sections of the code, where the Macro is called. Nevertheless, there are some assumptions on the structure of your data coded there.&lt;BR /&gt;My question is, how much do you understand of the macro code? I.e. can you "read" macros? And then: Do the SAS statements within the macro make sense to you? That was a way to keep the answers to your question short.&lt;BR /&gt;And of course: The person who provided you with the code should be able to tell you how to use it.&lt;BR /&gt;--FJa&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 12:27:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-i-substitute-my-variables-and-my-file-in-this-code/m-p/844807#M36726</guid>
      <dc:creator>fja</dc:creator>
      <dc:date>2022-11-17T12:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: How do i substitute my variables and my file in this code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-i-substitute-my-variables-and-my-file-in-this-code/m-p/844810#M36728</link>
      <description>Hi, thanks for answer. I understand a little of the code, and the person who provided it to me cannot explain</description>
      <pubDate>Thu, 17 Nov 2022 12:24:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-i-substitute-my-variables-and-my-file-in-this-code/m-p/844810#M36728</guid>
      <dc:creator>ari2495</dc:creator>
      <dc:date>2022-11-17T12:24:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do i substitute my variables and my file in this code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-i-substitute-my-variables-and-my-file-in-this-code/m-p/844813#M36730</link>
      <description>&lt;P&gt;Lovely. Does that person know how to create a dataset to work with it? There needs to be a&amp;nbsp;MOD_RATING_ALLA_DATA_RIF variable containing codes for "segments" (i.e. those values in "segmento" further in the code).&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 12:31:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-i-substitute-my-variables-and-my-file-in-this-code/m-p/844813#M36730</guid>
      <dc:creator>fja</dc:creator>
      <dc:date>2022-11-17T12:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do i substitute my variables and my file in this code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-i-substitute-my-variables-and-my-file-in-this-code/m-p/844816#M36731</link>
      <description>Let me explain better: I received this code as a model, and I need to customize it to my variables and dataset, but actually I do not know where to modify. For example, between pd est = pd weighted, which one is the variable of the final dataset, and which one instead is the variable of the original dataset to modify? Then I also need to understand where to specify the reference for macro</description>
      <pubDate>Thu, 17 Nov 2022 12:35:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-i-substitute-my-variables-and-my-file-in-this-code/m-p/844816#M36731</guid>
      <dc:creator>ari2495</dc:creator>
      <dc:date>2022-11-17T12:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do i substitute my variables and my file in this code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-i-substitute-my-variables-and-my-file-in-this-code/m-p/844820#M36734</link>
      <description>&lt;P&gt;If (and only if) your dataset meets the demands on its structure you needed to adjust these lines:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/436841"&gt;@ari2495&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;/*BASE*/
%AUC_test (input = Discr  , pd_est = PD0Base , default_flag = flag_default_finale, Segmento= IMP );
%AUC_test (input = Discr  , pd_est = PD0Base , default_flag = flag_default_finale, Segmento= POE );
%AUC_test (input = Discr  , pd_est = PD0Base , default_flag = flag_default_finale, Segmento= PRI );
%AUC_test (input = Discr  , pd_est = PD0Base , default_flag = flag_default_finale, Segmento= SMB );
/*WEIGHTED*/
%AUC_test (input = Discr  , pd_est = PD_weighted , default_flag = flag_default_finale, Segmento= IMP );
%AUC_test (input = Discr  , pd_est = PD_weighted , default_flag = flag_default_finale, Segmento= POE );
%AUC_test (input = Discr  , pd_est = PD_weighted , default_flag = flag_default_finale, Segmento= PRI );
%AUC_test (input = Discr  , pd_est = PD_weighted , default_flag = flag_default_finale, Segmento= SMB );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Where Discr needs to be your input table, PD0Base and PD_weighted columns with the pds and the Segmento= needs to be given a valid segment code (i.e. one in your table).&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 12:44:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-i-substitute-my-variables-and-my-file-in-this-code/m-p/844820#M36734</guid>
      <dc:creator>fja</dc:creator>
      <dc:date>2022-11-17T12:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do i substitute my variables and my file in this code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-i-substitute-my-variables-and-my-file-in-this-code/m-p/844823#M36736</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;HR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/436841"&gt;@ari2495&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;
data AUC_Base;
set _smd_pd0base_imp _smd_pd0base_poe _smd_pd0base_pri _smd_pd0base_smb;
run;
data AUC_Weighted;
set _smd_pd_weighted_imp _smd_pd_weighted_poe _smd_pd_weighted_pri _smd_pd_weighted_smb;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And these lines as well ... as the macro produces intermediate tables reflecting the arguments given to it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 12:56:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-i-substitute-my-variables-and-my-file-in-this-code/m-p/844823#M36736</guid>
      <dc:creator>fja</dc:creator>
      <dc:date>2022-11-17T12:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do i substitute my variables and my file in this code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-i-substitute-my-variables-and-my-file-in-this-code/m-p/844830#M36739</link>
      <description>thanks, i'm going to try.&lt;BR /&gt;can i ask you, what is, in the where statement, --&amp;gt; where MOD_RATING_ALLA_DATA_RIF= "&amp;amp;segmento."; MOD_RATIN?G? is it a variable?</description>
      <pubDate>Thu, 17 Nov 2022 13:14:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-i-substitute-my-variables-and-my-file-in-this-code/m-p/844830#M36739</guid>
      <dc:creator>ari2495</dc:creator>
      <dc:date>2022-11-17T13:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do i substitute my variables and my file in this code</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-i-substitute-my-variables-and-my-file-in-this-code/m-p/844850#M36743</link>
      <description>&lt;P&gt;The&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n1xbr9r0s9veq0n137iftzxq4g7e.htm" target="_self"&gt;WHERE statement&lt;/A&gt;&amp;nbsp;filters / selects observations that meet a certain condition. In this case it filters any observation with a variable that contains the "segmento" argument of the macro.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 13:43:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-i-substitute-my-variables-and-my-file-in-this-code/m-p/844850#M36743</guid>
      <dc:creator>fja</dc:creator>
      <dc:date>2022-11-17T13:43:38Z</dc:date>
    </item>
  </channel>
</rss>

