<?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 Define multiple values with one prompt (either directly or with in-program assignment) in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Define-multiple-values-with-one-prompt-either-directly-or-with/m-p/989447#M46507</link>
    <description>&lt;P&gt;Here is the issue;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At work, due to some changes in IT rules, colleagues have differently mapped online folders. This is an issue with shared projects that use those folders as libraries, so I am trying to define this dynamically. The idea is that when you run the project, you get a prompt for which user is running the query and then assign correct path to the program.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the issue is since there are multiple folders that I need to use with different paths. I was thinking of setting a dummy variable and then assign the actual path strings based on an if/then statement. What I cannot find is how to properly assign value to a macro variable with an if-then.&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jun 2026 08:51:06 GMT</pubDate>
    <dc:creator>Markus91</dc:creator>
    <dc:date>2026-06-10T08:51:06Z</dc:date>
    <item>
      <title>Define multiple values with one prompt (either directly or with in-program assignment)</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Define-multiple-values-with-one-prompt-either-directly-or-with/m-p/989447#M46507</link>
      <description>&lt;P&gt;Here is the issue;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At work, due to some changes in IT rules, colleagues have differently mapped online folders. This is an issue with shared projects that use those folders as libraries, so I am trying to define this dynamically. The idea is that when you run the project, you get a prompt for which user is running the query and then assign correct path to the program.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the issue is since there are multiple folders that I need to use with different paths. I was thinking of setting a dummy variable and then assign the actual path strings based on an if/then statement. What I cannot find is how to properly assign value to a macro variable with an if-then.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2026 08:51:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Define-multiple-values-with-one-prompt-either-directly-or-with/m-p/989447#M46507</guid>
      <dc:creator>Markus91</dc:creator>
      <dc:date>2026-06-10T08:51:06Z</dc:date>
    </item>
    <item>
      <title>Re: Define multiple values with one prompt (either directly or with in-program assignment)</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Define-multiple-values-with-one-prompt-either-directly-or-with/m-p/989512#M46509</link>
      <description>&lt;P&gt;Are you asking how to set the value of a macro variable?&amp;nbsp; You can use the %LET macro statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let mvar=new value;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or you could use the CALL SYMPUTX() statement in a data step.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  call symputx('mvar','new value');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To do it conditionally you could use conditional macro code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if &amp;amp;username=FRED %then %do;
  %let mvar=new value;
%end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or conditional data step code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  if "&amp;amp;username"="FRED" then do;
    call symputx('mvar','new value');
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But for something so complex you might want to make a dataset that contains the mapping&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mapping;
  infile datalines dsd truncover ;
  input username :$32. value :$200.;
datalines;
FRED,new value
JOE,old value
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and then use that. Either with a data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set mapping;
  where username="&amp;amp;username";
  call symputx('mvar',value);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or perhaps PROC SQL&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select value into :mvar trimmed
from mapping
where username="&amp;amp;username"
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or you might want to make a FORMAT that maps the username into the right value.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value $mapping
  'FRED'='new value'
  'JOE'='old value'
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Which you could then use with the PUT() or PUTC() function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let mvar=%sysfunc(putc(&amp;amp;username,$mapping.));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2026 18:08:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Define-multiple-values-with-one-prompt-either-directly-or-with/m-p/989512#M46509</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-06-10T18:08:00Z</dc:date>
    </item>
  </channel>
</rss>

