<?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: Appending values to a global variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Appending-values-to-a-global-variable/m-p/152458#M30028</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glad you got it working.&amp;nbsp; Sorry, typo in my symput suggestion.&amp;nbsp; There should NOT be an ampersand in the first argument.&amp;nbsp; Should have been:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data _null_;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; set percent_var (where=(default_rate&amp;gt;10));&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; call symput("list_predictor","&amp;amp;list_predictor &amp;amp;varname");&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; stop;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Idea of that step is take the resolved text string: "&amp;amp;list_predictor &amp;amp;varname"&amp;nbsp; and put in the macro variable List_Predictor.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;It's like:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; %let list_predictor=&amp;amp;list_predictor &amp;amp;varname;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;but doing it with call symput to make it conditional on existence of a record.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;But that is a non-traditional use of symput.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Your adaptation of my suggestion looks good.&amp;nbsp; Basically in the macro you are building the big dataset with all of your information on candidate predictors.&amp;nbsp; Often, once you have that sort of dataset, it proves useful for other things.&amp;nbsp; So generally there are many benefits to building such control datasets, in a long and skinny format.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 May 2014 14:30:39 GMT</pubDate>
    <dc:creator>Quentin</dc:creator>
    <dc:date>2014-05-12T14:30:39Z</dc:date>
    <item>
      <title>Appending values to a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Appending-values-to-a-global-variable/m-p/152448#M30018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I really could use some help in a task I have:&lt;/P&gt;&lt;P&gt;I have an initial global variable:&lt;/P&gt;&lt;P&gt;%let list_predictor= var1 var2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also have a database with 200 variables(let's say they are: var1 var2 var3 ... var200).&lt;/P&gt;&lt;P&gt;I have written a macro that returns, for each variable, a database that has a "percent" variable with 10 observations.&lt;/P&gt;&lt;P&gt;I want to be able to add the variables, for which percent&amp;gt;10, to &amp;amp;list_predictor.&lt;/P&gt;&lt;P&gt;If percent &amp;lt;10 then the global variable should retain its anterior form.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;in data "percent_var3" I have the variable "percent" that contains 10 values from 1 to 15.&lt;/P&gt;&lt;P&gt;I see that at least one value &amp;gt; 10 so I want to add "var3" to the list of global variables =&amp;gt; &amp;amp;list_predictor = var1 var2 var3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For data "percent_var4" the values are all &amp;lt; 10, so &amp;amp;list_predictor should stay = var1 var2 var3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and so on ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Considering that percent has 10obs, it is possible that more than 1obs is &amp;gt;10.&lt;/P&gt;&lt;P&gt;If this should be the case I don't need the global variable to recover the name of the variable multiple times.&lt;/P&gt;&lt;P&gt;So a double condition must be introduced: after sorting the database, last.percent and percent&amp;gt;10 should both be valid.&lt;/P&gt;&lt;P&gt;But consider that this code should stay inside of my macro and data step is compromised, since %if ... %then can't function as it usually does.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I really need some help, I have been concentrating on this the entire day and I have remained clueless.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2014 15:50:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Appending-values-to-a-global-variable/m-p/152448#M30018</guid>
      <dc:creator>loredana_cornea</dc:creator>
      <dc:date>2014-05-09T15:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: Appending values to a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Appending-values-to-a-global-variable/m-p/152449#M30019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It seems you quite some logic here to take on, and I don't really see the what you are trying to achieve. Perhaps you could tell us more of the underlying requirement?&lt;/P&gt;&lt;P&gt;Just a hunch, but often what this kind of problem occur, it's because the data structure is not optimal. Often transposing data (columns to rows) let do more dynamic programming without complicated macro looping algorithms.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2014 17:53:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Appending-values-to-a-global-variable/m-p/152449#M30019</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2014-05-09T17:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: Appending values to a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Appending-values-to-a-global-variable/m-p/152450#M30020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Agree with @LinusH regarding thinking about the data structures to make this easier.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you saying now you have 200 data sets percent_var1 percent_var2... percent_var200&amp;nbsp; ? And each has 10 records?&amp;nbsp; If you concatenated them all together, could you make a dataset like below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data have;
&amp;nbsp; input VarNum $ Percent;
&amp;nbsp; cards;
Var1 12
Var1 16
Var1 12
Var1 11
Var1 16
Var2 9
Var2 6
Var2 4
Var2 6
Var2 6
Var3 12
Var3 1
Var3 2
Var3 3
Var3 4
;
run;
&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;If so, then I think you could get your variable list with just:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;86&amp;nbsp;&amp;nbsp; proc sql noprint;
87&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select distinct(VarNum) into :listPredictor separated by " "
88&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from have
89&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where Percent&amp;gt;10
90&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;
91&amp;nbsp;&amp;nbsp; quit;

92
93&amp;nbsp;&amp;nbsp; %put &amp;amp;listpredictor;
Var1 Var3
&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;HTH,&lt;/P&gt;&lt;P&gt;-Q.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2014 18:21:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Appending-values-to-a-global-variable/m-p/152450#M30020</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2014-05-09T18:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: Appending values to a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Appending-values-to-a-global-variable/m-p/152451#M30021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well I have a database with more than 200 variables and I have computed for each one of them a default rate per quantile. If the default rate is superior to a number I choose I want to keep that variable because it is a good predictor. The default rates are calculated within a macro and each time this macro computes for each variable it creates a "percent_var" table which will be replaced with the default rates of the next variable computed. So no, I don't have 200 tables with 10 obs, each. I only have one that will replace its values every time I compute the macro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically, I want to store all the variables that are good predictors (for which the default rates are high enough) in a single global variable because afterwards I have some more conditions to impose to the selected variables and I don't want to write them by hand, because the database and the list of good predictors will change monthly and I don't want to change the sas program every time I have new data.&lt;/P&gt;&lt;P&gt;So the global variable will help me in the next data step where I get to keep only those that are good predictors.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 11 May 2014 12:18:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Appending-values-to-a-global-variable/m-p/152451#M30021</guid>
      <dc:creator>loredana_cornea</dc:creator>
      <dc:date>2014-05-11T12:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: Appending values to a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Appending-values-to-a-global-variable/m-p/152452#M30022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your idea is good, but doesn't apply here ...&amp;nbsp; Basically I don't have a variable called varnum that contains the name of the actual variable. I only have "default rate" and "Percentile_name". But since I am in a macro and I run it, let's say for "var1" I can use &amp;amp;var1 as a reference for the command I should give for the global variable.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 11 May 2014 18:39:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Appending-values-to-a-global-variable/m-p/152452#M30022</guid>
      <dc:creator>loredana_cornea</dc:creator>
      <dc:date>2014-05-11T18:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: Appending values to a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Appending-values-to-a-global-variable/m-p/152453#M30023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What exactly do you need help with? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It sounds like you have a process in mind, something like the following. &lt;/P&gt;&lt;P&gt;1. Calculate default rate per quantile per variable&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; Check if default rate is more than set amount&lt;/P&gt;&lt;P&gt;3. Store variables with the default rate &amp;gt; a set amount&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2/3 depend on how you do one, so how are you doing that part?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 11 May 2014 23:39:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Appending-values-to-a-global-variable/m-p/152453#M30023</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-05-11T23:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Appending values to a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Appending-values-to-a-global-variable/m-p/152454#M30024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, it feels a bit like I'm shooting in the dark, but I'll shoot again.&amp;nbsp; But agree with Reeza, would be easier to help if you gave more information/ sample data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It sounds like you have a macro that is looping over the variables in a dataset.&amp;nbsp; (already sounds odd, but let's proceed).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;During each macro loop, lets say you have macro variable &amp;amp;varname which is the name of the current variable (predictor) you are testing.&amp;nbsp; And after processing that variable, you end up with a dataset percent_var which has a variable named default_rate and 10 observations.&amp;nbsp; If any record in that dataset has a value of default_rate&amp;gt;10, then you want to insert &amp;amp;varname into your list of interesting predictors.&amp;nbsp; If that's close, in your macro loop you could do something like (untested):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set percent_var (where=(default_rate&amp;gt;10));&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symput("&amp;amp;list_predictor","&amp;amp;list_predictor &amp;amp;varname");&lt;/P&gt;&lt;P&gt;&amp;nbsp; stop;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Idea being that that step would run once for each potential predictor you are testing.&amp;nbsp; If there is a record where default_rate is greater than 10, the call symput statement will run, appeding the name of the predictor (&amp;amp;varname) to your list of interesting predictors (&amp;amp;list_predictor).&amp;nbsp; If there are no records with default_rate&amp;gt;10, then the call symput statement will not execute, because the step will end when the set statement executes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2014 01:15:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Appending-values-to-a-global-variable/m-p/152454#M30024</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2014-05-12T01:15:06Z</dc:date>
    </item>
    <item>
      <title>Re: Appending values to a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Appending-values-to-a-global-variable/m-p/152455#M30025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Quentin, you've perfectly understood what i'm trying to do. Unfortunately, the code you provided isn't working. I get the following error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: Symbolic variable name SIREN DEFAULT_RATE must contain only letters, digits, and underscores.&amp;nbsp;&amp;nbsp; /* siren default_rate -&amp;nbsp; are the 2 initial variables in my &amp;amp;list_predictor */&lt;/P&gt;&lt;P&gt;NOTE: Argument 1 to function SYMPUTX at line 11 column 155 is invalid.&lt;/P&gt;&lt;P&gt;percentile_name=0-10 default_rate=1 COUNT=2801 PERCENT=5.3384920332 _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 WORK.PERCENT_VAR.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE percent&amp;gt;10;&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;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It might be because of this: &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;"&amp;amp;list_predictor &amp;amp;varname"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;I think it should be written in some other way.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Plus I have read that to be able to use an already existing global variable in a call symput/x routine it should afterwards be specified: list_predictor=resolve('&amp;amp;list_predictor')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;I have tried it but doesn't work.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Something is missing.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;I'm sure it's a call symputx job, but i'm not very sure how to "tell it what i want to be done"&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Although I have incorporated th&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2014 12:49:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Appending-values-to-a-global-variable/m-p/152455#M30025</guid>
      <dc:creator>loredana_cornea</dc:creator>
      <dc:date>2014-05-12T12:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: Appending values to a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Appending-values-to-a-global-variable/m-p/152456#M30026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The first 2 steps are done. I only have the third one&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2014 13:04:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Appending-values-to-a-global-variable/m-p/152456#M30026</guid>
      <dc:creator>loredana_cornea</dc:creator>
      <dc:date>2014-05-12T13:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: Appending values to a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Appending-values-to-a-global-variable/m-p/152457#M30027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well guys, I have solved it in a not-so elegant manner. Quentin, thank you, I have taken your idea and adapted it:&lt;/P&gt;&lt;P&gt;/* macro */&lt;/P&gt;&lt;P&gt;data percent_var;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length varname $ 20;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set percent_var;&lt;/P&gt;&lt;P&gt;&amp;nbsp; varname="&amp;amp;var";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc append base=predictors data=percent_var (where=(percent&amp;gt;10)) nowarn force;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;/* end macro */&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select distinct(varname) into :list_predictors separated by " "&lt;/P&gt;&lt;P&gt;&amp;nbsp; from predictors;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;%put &amp;amp;list_predictors;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2014 13:18:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Appending-values-to-a-global-variable/m-p/152457#M30027</guid>
      <dc:creator>loredana_cornea</dc:creator>
      <dc:date>2014-05-12T13:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: Appending values to a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Appending-values-to-a-global-variable/m-p/152458#M30028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glad you got it working.&amp;nbsp; Sorry, typo in my symput suggestion.&amp;nbsp; There should NOT be an ampersand in the first argument.&amp;nbsp; Should have been:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data _null_;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; set percent_var (where=(default_rate&amp;gt;10));&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; call symput("list_predictor","&amp;amp;list_predictor &amp;amp;varname");&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; stop;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Idea of that step is take the resolved text string: "&amp;amp;list_predictor &amp;amp;varname"&amp;nbsp; and put in the macro variable List_Predictor.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;It's like:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; %let list_predictor=&amp;amp;list_predictor &amp;amp;varname;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;but doing it with call symput to make it conditional on existence of a record.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;But that is a non-traditional use of symput.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Your adaptation of my suggestion looks good.&amp;nbsp; Basically in the macro you are building the big dataset with all of your information on candidate predictors.&amp;nbsp; Often, once you have that sort of dataset, it proves useful for other things.&amp;nbsp; So generally there are many benefits to building such control datasets, in a long and skinny format.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2014 14:30:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Appending-values-to-a-global-variable/m-p/152458#M30028</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2014-05-12T14:30:39Z</dc:date>
    </item>
  </channel>
</rss>

