<?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: Global Variables with Symputx in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Global-Variables-with-Symputx/m-p/576009#M12979</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.Eqn1415_Warning0;
	set work.Primary_group4 end=eof;
	by constituent_name;
	retain flagit 0;
	retain warning0;
	if first.constituent_name then PrimaryResultsCount=0;
	PrimaryResultsCount+1;
	if last.constituent_name then do;
		if PrimaryResultsCount&amp;lt;6 or conversionfactor= . then do;
				WARNING0=constituent_name;
			if warning0="Cobalt-60" then call symputx("Cobalt60_flag0","(0)Cobalt60 ");
			else call symputx("Cobalt60_flag0"," ");
			if warning0="Europium-154" then call symputx("Europium154_flag0","(0)Europium154");
			else call symputx("Europium154_flag0"," ");
			if warning0="Plutonium-239/240" then call symputx("Plutonium239_flag0","(0)Plutonium-239 ");
			else call symputx("Plutonium239_flag0"," ");
			if constituent_name="Curium-242" then call symputx("Curium242_flag0","(0)Cobalt60 ");
			else call symputx("Curium242_flag0"," ");
			if warning0="Technetium-99" then call symputx("Technetium99_flag0","(0)Technetium99");
			else call symputx("Technetium99_flag0"," ");
				flagit+1;
				end;
		output;
		end;
	if flagit ne 0 then call symputx("Eqn1415_flag0","(0)"); 
			else call symputx("Eqn1415_flag0"," ");
	drop reported_value  Reported_Units Qualifiers Converted_flag  Result_Type flagit;
run;

%put &amp;amp;Eqn1415_flag0;
%put &amp;amp;Cobalt60_flag0;
%put &amp;amp;Plutonium239_flag0;
%put &amp;amp;Technetium99_flag0;
%put &amp;amp;Curium242_flag0;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This produces the same results but only uses symputx when the last constituent_name.&lt;/P&gt;</description>
    <pubDate>Wed, 24 Jul 2019 00:23:49 GMT</pubDate>
    <dc:creator>jawhitmire</dc:creator>
    <dc:date>2019-07-24T00:23:49Z</dc:date>
    <item>
      <title>Global Variables with Symputx</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Global-Variables-with-Symputx/m-p/576002#M12975</link>
      <description>&lt;P&gt;SAS Version 9.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following source code....&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data= work.Primary_group4; by constituent_name ; run;

data work.Eqn1415_Warning0;
	set work.Primary_group4 end=eof;
	by constituent_name;
	retain flagit 0;
	retain warning0;
	if first.constituent_name then PrimaryResultsCount=0;
	PrimaryResultsCount+1;
	if last.constituent_name then do;
		if PrimaryResultsCount&amp;lt;6 or conversionfactor= . then do;
				WARNING0=constituent_name;
				flagit+1;
				end;
		output;
		end;
	if flagit ne 0 then call symputx("Eqn1415_flag0","(0)"); 
			else call symputx("Eqn1415_flag0"," ");
	if warning0="Curium-242" then call symputx("Curium242_flag0","(0)Cobalt60 ");
			else call symputx("Curium242_flag0"," ");
	if warning0="Cobalt-60" then call symputx("Cobalt60_flag0","(0)Cobalt60 ");
			else call symputx("Cobalt60_flag0"," ");
	if warning0="Europium-154" then call symputx("Europium154_flag0","(0)Europium154");
			else call symputx("Europium154_flag0"," ");
	if warning0="Plutonium-239/240" then call symputx("Plutonium239_flag0","(0)Plutonium-239 ");
			else call symputx("Plutonium239_flag0"," ");
	if warning0="Technetium-99" then call symputx("Technetium99_flag0","(0)Technetium99");
			else call symputx("Technetium99_flag0"," ");
	drop reported_value  Reported_Units Qualifiers Converted_flag  Result_Type flagit;
run;

%put &amp;amp;Eqn1415_flag0;
%put &amp;amp;Cobalt60_flag0;
%put &amp;amp;Plutonium239_flag0;
%put &amp;amp;Technetium99_flag0;
%put &amp;amp;Curium242_flag0;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Creates the dataset work.Eqn1415_warning0....&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="7.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31248iE48179B9CFA4969D/image-size/large?v=v2&amp;amp;px=999" role="button" title="7.JPG" alt="7.JPG" /&gt;&lt;/span&gt;ddd&lt;/P&gt;&lt;P&gt;The log is showing the calls to symputx failed for Plutonium-239/240, Curium242_flag0, but worked for Technetium99_flag0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;2397  %put &amp;amp;Eqn1415_flag0;
(0)
2398  %put &amp;amp;Cobalt60_flag0;

2399  %put &amp;amp;Plutonium239_flag0;

2400  %put &amp;amp;Technetium99_flag0;
(0)Technetium99
2401  %put &amp;amp;Curium242_flag0;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Totally confused as how to fix it so that the flags work whenever warning0 is given a constituent name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jane&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2019 23:48:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Global-Variables-with-Symputx/m-p/576002#M12975</guid>
      <dc:creator>jawhitmire</dc:creator>
      <dc:date>2019-07-23T23:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variables with Symputx</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Global-Variables-with-Symputx/m-p/576006#M12977</link>
      <description>The IF THEN ELSE logic that uses CALL SYMPUTX gets applied on every observation.  So the macro variables get replaced every time.  The final values depend on the final observation only.&lt;BR /&gt;&lt;BR /&gt;What is the result that you would like to see?</description>
      <pubDate>Wed, 24 Jul 2019 00:08:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Global-Variables-with-Symputx/m-p/576006#M12977</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-07-24T00:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variables with Symputx</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Global-Variables-with-Symputx/m-p/576007#M12978</link>
      <description>&lt;P&gt;Thank you for the quick reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to flag each constituent with a warning. &amp;nbsp;&lt;/P&gt;&lt;P&gt;That is, create a macro variable that is blank when there is no warning, but prints the name of the constituent when conversionfactor is . or when PrimaryResultsCount&amp;lt;6. &amp;nbsp;&lt;/P&gt;&lt;P&gt;The macro will later be referenced in an executive summary.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;Jane&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 00:15:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Global-Variables-with-Symputx/m-p/576007#M12978</guid>
      <dc:creator>jawhitmire</dc:creator>
      <dc:date>2019-07-24T00:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variables with Symputx</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Global-Variables-with-Symputx/m-p/576009#M12979</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.Eqn1415_Warning0;
	set work.Primary_group4 end=eof;
	by constituent_name;
	retain flagit 0;
	retain warning0;
	if first.constituent_name then PrimaryResultsCount=0;
	PrimaryResultsCount+1;
	if last.constituent_name then do;
		if PrimaryResultsCount&amp;lt;6 or conversionfactor= . then do;
				WARNING0=constituent_name;
			if warning0="Cobalt-60" then call symputx("Cobalt60_flag0","(0)Cobalt60 ");
			else call symputx("Cobalt60_flag0"," ");
			if warning0="Europium-154" then call symputx("Europium154_flag0","(0)Europium154");
			else call symputx("Europium154_flag0"," ");
			if warning0="Plutonium-239/240" then call symputx("Plutonium239_flag0","(0)Plutonium-239 ");
			else call symputx("Plutonium239_flag0"," ");
			if constituent_name="Curium-242" then call symputx("Curium242_flag0","(0)Cobalt60 ");
			else call symputx("Curium242_flag0"," ");
			if warning0="Technetium-99" then call symputx("Technetium99_flag0","(0)Technetium99");
			else call symputx("Technetium99_flag0"," ");
				flagit+1;
				end;
		output;
		end;
	if flagit ne 0 then call symputx("Eqn1415_flag0","(0)"); 
			else call symputx("Eqn1415_flag0"," ");
	drop reported_value  Reported_Units Qualifiers Converted_flag  Result_Type flagit;
run;

%put &amp;amp;Eqn1415_flag0;
%put &amp;amp;Cobalt60_flag0;
%put &amp;amp;Plutonium239_flag0;
%put &amp;amp;Technetium99_flag0;
%put &amp;amp;Curium242_flag0;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This produces the same results but only uses symputx when the last constituent_name.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 00:23:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Global-Variables-with-Symputx/m-p/576009#M12979</guid>
      <dc:creator>jawhitmire</dc:creator>
      <dc:date>2019-07-24T00:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variables with Symputx</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Global-Variables-with-Symputx/m-p/576013#M12980</link>
      <description>&lt;P&gt;How are you naming the macro variables?&amp;nbsp; They need to have valid SAS names. So a value like&amp;nbsp;&lt;SPAN&gt;Plutonium-239/240 is not value because of the hyphen and slash.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 01:25:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Global-Variables-with-Symputx/m-p/576013#M12980</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-24T01:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variables with Symputx</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Global-Variables-with-Symputx/m-p/576014#M12981</link>
      <description>&lt;P&gt;Why are you testing FLAGIT when that variable will increment across groups?&lt;/P&gt;
&lt;P&gt;Did you forget to reset it to zero when starting a new group?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 01:28:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Global-Variables-with-Symputx/m-p/576014#M12981</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-24T01:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variables with Symputx</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Global-Variables-with-Symputx/m-p/576026#M12982</link>
      <description>Jane,&lt;BR /&gt;&lt;BR /&gt;It's easy to set up flags, as many as are helpful.  But macro variables are the wrong tool for the job.  Just set up DATA step variables instead.  That would let you save separate flags for each person, and report the results pretty easily.  Macro variables don't support either of those objectives.</description>
      <pubDate>Wed, 24 Jul 2019 02:23:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Global-Variables-with-Symputx/m-p/576026#M12982</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-07-24T02:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variables with Symputx</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Global-Variables-with-Symputx/m-p/576147#M13012</link>
      <description>&lt;P&gt;Thank you for the reply.&lt;/P&gt;&lt;P&gt;The dataset is very large with constituent_name as shown "239/240" .&lt;/P&gt;&lt;P&gt;I must work with it as given, but was careful of the formatting for the macro name.&lt;/P&gt;&lt;P&gt;Is there a way to ignore the "/" from the imported Excel spreadsheet?&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;Jane&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 13:15:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Global-Variables-with-Symputx/m-p/576147#M13012</guid>
      <dc:creator>jawhitmire</dc:creator>
      <dc:date>2019-07-24T13:15:17Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variables with Symputx</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Global-Variables-with-Symputx/m-p/576150#M13014</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/248885"&gt;@jawhitmire&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you for the reply.&lt;/P&gt;
&lt;P&gt;The dataset is very large with constituent_name as shown "239/240" .&lt;/P&gt;
&lt;P&gt;I must work with it as given, but was careful of the formatting for the macro name.&lt;/P&gt;
&lt;P&gt;Is there a way to ignore the "/" from the imported Excel spreadsheet?&lt;/P&gt;
&lt;P&gt;Thanks again,&lt;/P&gt;
&lt;P&gt;Jane&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It is not clear at all what you intend to do with these macro variables, but such a case it would probably be best to just assign a number to each (whatever you unit is here) and use the number in generating the macro variable name.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 13:20:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Global-Variables-with-Symputx/m-p/576150#M13014</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-24T13:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variables with Symputx</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Global-Variables-with-Symputx/m-p/576245#M13035</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/248885"&gt;@jawhitmire&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you for the quick reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to flag each constituent with a warning. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is, create a macro variable that is blank when there is no warning, but prints the name of the constituent when conversionfactor is . or when PrimaryResultsCount&amp;lt;6. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;The macro will later be referenced in an executive summary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again,&lt;/P&gt;
&lt;P&gt;Jane&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;How are you creating the executive summary? If it is to create a list of those with a flag set then consider:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
   set sashelp.class;
   if sex='F' then weightflag= weight&amp;gt;90;
   else if sex='M' then weightflag= weight&amp;gt;110;
run;

Proc print data=want noobs;
   where weightflag;
   title "Names of children with Weight Flag set";
   var name;
run;title;&lt;/PRE&gt;
&lt;P&gt;The rules for weightflag were very arbitrary just to create the flag variable as a dichotomous 1/0 coded value.&lt;/P&gt;
&lt;P&gt;Select the values to display with a where clause for example and Var to show the values you need for your summary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Better might be to provide some example data in the form of data step code and how you want the executive summary to appear.&lt;/P&gt;
&lt;P&gt;There are LOTS of things that can be done with properly structured data and report procedures. Stuffing lots of values into macro variables is quite often the most difficult to get nice output from.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 16:35:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Global-Variables-with-Symputx/m-p/576245#M13035</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-07-24T16:35:47Z</dc:date>
    </item>
  </channel>
</rss>

