<?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 Cannot assign libname with macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Cannot-assign-libname-with-macro/m-p/846777#M334743</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have issue in this code, not sure why it is not working:&lt;/P&gt;&lt;P&gt;All that I am trying to do is:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;From a bunch of directories in a folder, I am just selecting 1 of them.&lt;/LI&gt;&lt;LI&gt;That 1 value needs to be used in the libname statement.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;If I make that as %global then it would work. But don't think that is a good practice.&lt;/P&gt;&lt;P&gt;Can you please help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%macro returnfoldername(key_985632=);
	filename ps_list pipe "ls -l /sasdata/path/to/folder";

	data _null_;
		infile ps_list;
		length process $ 200;
		input process $ char200.;

		if index(process,"&amp;amp;key_985632.")&amp;gt;0;
		call symput('returnfoldername_985632',substr(process,index(process,"&amp;amp;key_985632."),length(process)-index(process,"&amp;amp;key_985632.")+1&lt;BR /&gt;                                                            )&lt;BR /&gt;                            );
	run;

	&amp;amp;returnfoldername_985632.;
%mend returnfoldername;

options symbolgen mprint mlogic;
%let camp_key=123456;
libname follow1		"/sasdata/path/to/folder/%returnfoldername(key_985632=&amp;amp;camp_key.)";&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 29 Nov 2022 12:04:30 GMT</pubDate>
    <dc:creator>david27</dc:creator>
    <dc:date>2022-11-29T12:04:30Z</dc:date>
    <item>
      <title>Cannot assign libname with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-assign-libname-with-macro/m-p/846777#M334743</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have issue in this code, not sure why it is not working:&lt;/P&gt;&lt;P&gt;All that I am trying to do is:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;From a bunch of directories in a folder, I am just selecting 1 of them.&lt;/LI&gt;&lt;LI&gt;That 1 value needs to be used in the libname statement.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;If I make that as %global then it would work. But don't think that is a good practice.&lt;/P&gt;&lt;P&gt;Can you please help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%macro returnfoldername(key_985632=);
	filename ps_list pipe "ls -l /sasdata/path/to/folder";

	data _null_;
		infile ps_list;
		length process $ 200;
		input process $ char200.;

		if index(process,"&amp;amp;key_985632.")&amp;gt;0;
		call symput('returnfoldername_985632',substr(process,index(process,"&amp;amp;key_985632."),length(process)-index(process,"&amp;amp;key_985632.")+1&lt;BR /&gt;                                                            )&lt;BR /&gt;                            );
	run;

	&amp;amp;returnfoldername_985632.;
%mend returnfoldername;

options symbolgen mprint mlogic;
%let camp_key=123456;
libname follow1		"/sasdata/path/to/folder/%returnfoldername(key_985632=&amp;amp;camp_key.)";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Nov 2022 12:04:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-assign-libname-with-macro/m-p/846777#M334743</guid>
      <dc:creator>david27</dc:creator>
      <dc:date>2022-11-29T12:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot assign libname with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-assign-libname-with-macro/m-p/846782#M334744</link>
      <description>&lt;P&gt;Whenever you have errors in the log, show us the log — all of it for this macro, every single character for this macro, with nothing chopped out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Copy the log as text and paste it into the window that appears when you click on the &amp;lt;/&amp;gt; icon.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PaigeMiller_0-1663012019648.png" style="width: 859px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75161i0E71B1489A6C9839/image-size/large?v=v2&amp;amp;px=999" role="button" title="PaigeMiller_0-1663012019648.png" alt="PaigeMiller_0-1663012019648.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 12:45:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-assign-libname-with-macro/m-p/846782#M334744</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-11-29T12:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot assign libname with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-assign-libname-with-macro/m-p/846783#M334745</link>
      <description>&lt;UL&gt;
&lt;LI&gt;If you want to use a variable created in a macro outside of that macro, it has to be global. The only way to keep the variable local is moving the libname statement into the macro.&lt;/LI&gt;
&lt;LI&gt;You can't use data or proc steps in a macro that is used as function. Enable option mprint to see what happens, actually.&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Tue, 29 Nov 2022 12:50:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-assign-libname-with-macro/m-p/846783#M334745</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-11-29T12:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot assign libname with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-assign-libname-with-macro/m-p/846789#M334747</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code:&lt;/P&gt;&lt;PRE&gt;%macro returnfoldername(key_985632=);

filename ps_list pipe "ls -l /sasdata/MACME/PRD/CAMPAIGNS";
data _null_ ;
   infile ps_list ;
   length process $ 200;
   input process $ char200.;

if index(process,"&amp;amp;key_985632.")&amp;gt;0 ;
call symput('retval',substr(process,index(process,"&amp;amp;key_985632."),length(process)-index(process,"&amp;amp;key_985632.")+1));
run;
&amp;amp;retval.;
%mend returnfoldername;

options symbolgen mprint mlogic;
%let pr_co_fd_camp1=12772;
libname follow1		"/sasdata/MACME/PRD/CAMPAIGNS/%returnfoldername(key_985632=12772)"; &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the Log:&lt;/P&gt;&lt;PRE&gt;1 The SAS System                                                                                                                                                                                                                08:19 Tuesday, November 29, 2022

1          ;*';*";*/;quit;run;
2          OPTIONS PAGENO=MIN;
3          %LET _CLIENTTASKLABEL='Program';
4          %LET _CLIENTPROCESSFLOWNAME='Standalone Not In Project';
5          %LET _CLIENTPROJECTPATH='';
6          %LET _CLIENTPROJECTPATHHOST='';
7          %LET _CLIENTPROJECTNAME='';
8          %LET _SASPROGRAMFILE='';
9          %LET _SASPROGRAMFILEHOST='';
10         
11         ODS _ALL_ CLOSE;
12         OPTIONS DEV=SVG;
13         GOPTIONS XPIXELS=0 YPIXELS=0;
14         %macro HTML5AccessibleGraphSupported;
15             %if %_SAS_VERCOMP_FV(9,4,4, 0,0,0) &amp;gt;= 0 %then ACCESSIBLE_GRAPH;
16         %mend;
17         FILENAME EGHTML TEMP;
18         ODS HTML5(ID=EGHTML) FILE=EGHTML
19             OPTIONS(BITMAP_MODE='INLINE')
20             %HTML5AccessibleGraphSupported
MLOGIC(HTML5ACCESSIBLEGRAPHSUPPORTED):  Beginning execution.
MLOGIC(_SAS_VERCOMP_FV):  Beginning execution.
MLOGIC(_SAS_VERCOMP_FV):  Parameter FMAJOR has value 9
MLOGIC(_SAS_VERCOMP_FV):  Parameter FMINOR has value 4
MLOGIC(_SAS_VERCOMP_FV):  Parameter FMAINT has value 4
MLOGIC(_SAS_VERCOMP_FV):  Parameter VMAJOR has value 0
MLOGIC(_SAS_VERCOMP_FV):  Parameter VMINOR has value 0
MLOGIC(_SAS_VERCOMP_FV):  Parameter VMAINT has value 0
MLOGIC(_SAS_VERCOMP_FV):  %LOCAL  MAJOR
MLOGIC(_SAS_VERCOMP_FV):  %LOCAL  MINOR
MLOGIC(_SAS_VERCOMP_FV):  %LOCAL  MAINT
MLOGIC(_SAS_VERCOMP_FV):  %LOCAL  CURMAJ
MLOGIC(_SAS_VERCOMP_FV):  %LOCAL  CURMIN
MLOGIC(_SAS_VERCOMP_FV):  %LOCAL  CURMNT
MLOGIC(_SAS_VERCOMP_FV):  %LET (variable name is CURMAJ)
SYMBOLGEN:  Macro variable SYSVLONG resolves to 9.04.01M6P110718
SYMBOLGEN:  Macro variable CURMAJ resolves to 9
MLOGIC(_SAS_VERCOMP_FV):  %IF condition %eval(&amp;amp;CurMaj EQ V) is FALSE
MLOGIC(_SAS_VERCOMP_FV):  %LET (variable name is MAJOR)
SYMBOLGEN:  Macro variable FMAJOR resolves to 9
MLOGIC(_SAS_VERCOMP_FV):  %LET (variable name is MINOR)
SYMBOLGEN:  Macro variable FMINOR resolves to 4
MLOGIC(_SAS_VERCOMP_FV):  %LET (variable name is MAINT)
SYMBOLGEN:  Macro variable FMAINT resolves to 4
MLOGIC(_SAS_VERCOMP_FV):  %LET (variable name is CURMIN)
SYMBOLGEN:  Macro variable SYSVLONG resolves to 9.04.01M6P110718
MLOGIC(_SAS_VERCOMP_FV):  %LET (variable name is CURMNT)
SYMBOLGEN:  Macro variable SYSVLONG resolves to 9.04.01M6P110718
SYMBOLGEN:  Macro variable MAJOR resolves to 9
SYMBOLGEN:  Macro variable CURMAJ resolves to 9
MLOGIC(_SAS_VERCOMP_FV):  %IF condition %eval(&amp;amp;major NE &amp;amp;CurMaj) is FALSE
SYMBOLGEN:  Macro variable MINOR resolves to 4
SYMBOLGEN:  Macro variable CURMIN resolves to 04
MLOGIC(_SAS_VERCOMP_FV):  %IF condition %eval(&amp;amp;minor NE &amp;amp;CurMin) is FALSE
SYMBOLGEN:  Macro variable MAINT resolves to 4
MLOGIC(_SAS_VERCOMP_FV):  %IF condition "&amp;amp;maint" = "" is FALSE
SYMBOLGEN:  Macro variable CURMNT resolves to 6
SYMBOLGEN:  Macro variable MAINT resolves to 4
MLOGIC(_SAS_VERCOMP_FV):  Ending execution.
MLOGIC(HTML5ACCESSIBLEGRAPHSUPPORTED):  %IF condition %_SAS_VERCOMP_FV(9,4,4, 0,0,0) &amp;gt;= 0 is TRUE
MPRINT(HTML5ACCESSIBLEGRAPHSUPPORTED):   ACCESSIBLE_GRAPH
MLOGIC(HTML5ACCESSIBLEGRAPHSUPPORTED):  Ending execution.
21             ENCODING='utf-8'
22             STYLE=HTMLBlue
23             NOGTITLE
24             NOGFOOTNOTE
25             GPATH=&amp;amp;sasworklocation
SYMBOLGEN:  Macro variable SASWORKLOCATION resolves to "/saswork/SAS_workF70B00008B0E_amz-psaslx01/SAS_workD77F00008B0E_amz-psaslx01/"
2 The SAS System                                                                                                                                                                                                                08:19 Tuesday, November 29, 2022

26         ;
NOTE: Writing HTML5(EGHTML) Body file: EGHTML
27         
28         %macro returnfoldername(key_985632=);
29         
30         filename ps_list pipe "ls -l /sasdata/MACME/PRD/CAMPAIGNS";
31         data _null_ ;
32            infile ps_list ;
33            length process $ 200;
34            input process $ char200.;
35         
36         if index(process,"&amp;amp;key_985632.")&amp;gt;0 ;
37         call symput('retval',substr(process,index(process,"&amp;amp;key_985632."),length(process)-index(process,"&amp;amp;key_985632.")+1));
38         run;
39         &amp;amp;retval.;
40         %mend returnfoldername;
41         
42         options symbolgen mprint mlogic;
43         %let pr_co_fd_camp1=12772;
44         libname follow1		"/sasdata/MACME/PRD/CAMPAIGNS/%returnfoldername(key_985632=12772)";
MLOGIC(RETURNFOLDERNAME):  Beginning execution.
MLOGIC(RETURNFOLDERNAME):  Parameter KEY_985632 has value 12772
SYMBOLGEN:  Macro variable KEY_985632 resolves to 12772
SYMBOLGEN:  Macro variable KEY_985632 resolves to 12772

             ______________________________
             49

             _____________________________________________________
             49
NOTE: Line generated by the macro variable "KEY_985632".
44         "; data _null_ ;    infile ps_list ;    length process $ 200;    input process $ char200.;  if index(process,"12772
           ______________________________________________________________________________________________________________
           49
NOTE: Line generated by the macro variable "KEY_985632".
44         ")&amp;gt;0 ; call symput('retval',substr(process,index(process,"12772
           __________________________________________________________
           49
SYMBOLGEN:  Macro variable KEY_985632 resolves to 12772
NOTE: Line generated by the macro variable "KEY_985632".
44         "),length(process)-index(process,"12772
           __________________________________
           49
WARNING: Apparent symbolic reference RETVAL not resolved.
NOTE 137-205: Line generated by the invoked macro "RETURNFOLDERNAME".
44         filename ps_list pipe "ls -l /sasdata/MACME/PRD/CAMPAIGNS"; data _null_ ;    infile ps_list ;    length process $ 200;    input process $ char200.;  if index(process,"&amp;amp;key_985632.")&amp;gt;0 ; call
                                  __
                                  22
44       ! symput('retval',substr(process,index(process,"&amp;amp;key_985632.")
NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release.  Inserting white space between a quoted string and the succeeding identifier is recommended.

ERROR 22-7: Invalid option name LS.

MPRINT(RETURNFOLDERNAME):   follow1 "/sasdata/MACME/PRD/CAMPAIGNS/filename ps_list pipe "ls
MLOGIC(RETURNFOLDERNAME):  Ending execution.
MPRINT(RETURNFOLDERNAME):   -l /sasdata/MACME/PRD/CAMPAIGNS"; data _null_ ;    infile ps_list ;    length process $ 200;    input process $ char200.;  if index(process,"12772")&amp;gt;0 ; call 
symput('retval',substr(process,index(process,"12772"),length(process)-index(process,"12772")+1)); run; &amp;amp;retval.;"
ERROR: Libref FOLLOW1 is not assigned.
ERROR: Error in the LIBNAME statement.
45         
46         %LET _CLIENTTASKLABEL=;
47         %LET _CLIENTPROCESSFLOWNAME=;
48         %LET _CLIENTPROJECTPATH=;
49         %LET _CLIENTPROJECTPATHHOST=;
50         %LET _CLIENTPROJECTNAME=;
51         %LET _SASPROGRAMFILE=;
52         %LET _SASPROGRAMFILEHOST=;
53         
3 The SAS System                                                                                                                                                                                                                08:19 Tuesday, November 29, 2022

54         ;*';*";*/;quit;run;
55         ODS _ALL_ CLOSE;
56         
57         
58         QUIT; RUN;
59         &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 13:22:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-assign-libname-with-macro/m-p/846789#M334747</guid>
      <dc:creator>david27</dc:creator>
      <dc:date>2022-11-29T13:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot assign libname with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-assign-libname-with-macro/m-p/846790#M334748</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm confused about the big picture. &amp;nbsp;Are you saying "I know there is a folder in a certain directory and I know the folder's name starts with 123456, but I don't know the full name of the folder so need to find it"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You're right that generally it is good to avoid generating global macro variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As Andreas mentioned, a general rule of function-style macros is that they can't contain SAS statements/steps. &amp;nbsp;They can only contain macro language statements. &amp;nbsp;This is because when a macro executes, it executes the macro language statements, but it only generates the SAS statements. &amp;nbsp;So as written, SAS starts to compile your libname statement, then in the middle of doing that suddenly it hits a filename statement and everything breaks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have a few options.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One is to abandon the function-style macro approach. &amp;nbsp;You could move your LIBNAME statement into the macro definition. &amp;nbsp;This changes your macro purpose from ReturnFolderName to MakeLibref. &amp;nbsp;That's probably the quickest/easiest change.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to keep this as a function-style macro you could rewrite the macro to use pure macro statements. &amp;nbsp;It's possible to do this sort of directory crawling with %sysfunc(open()) etc, &amp;nbsp;but I find it annoying.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another option for keeping this as a function-style macro is to change the design to use DOSUBL, called by %sysfunc, to execute the SAS code generated by the macro. This is a bit more advanced, but DOSUBL is a great tool to consider. &amp;nbsp;For more on DOSUBL, see this paper, which I think of as new but is apparently almost 10 years old. &amp;nbsp;&lt;A href="https://www.lexjansen.com/nesug/nesug13/139_Final_Paper.pdf" target="_blank"&gt;https://www.lexjansen.com/nesug/nesug13/139_Final_Paper.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 13:22:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-assign-libname-with-macro/m-p/846790#M334748</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2022-11-29T13:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot assign libname with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-assign-libname-with-macro/m-p/846795#M334750</link>
      <description>&lt;P&gt;I think&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;has pointed out the flaw in what you are doing. Your macro %return_foldername uses DATA step code, and DATA step code cannot appear in a LIBNAME statement. That's what happens when you call a macro, the macro call is replaced with the code generated by the macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But this ought to work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro returnfoldername();

filename ps_list pipe "ls -l /sasdata/MACME/PRD/CAMPAIGNS";
data _null_ ;
   infile ps_list ;
   length process $ 200;
   input process $ char200.;

if index(process,"&amp;amp;key_985632.")&amp;gt;0 ;
call symput('retval',substr(process,index(process,"&amp;amp;key_985632."),length(process)-index(process,"&amp;amp;key_985632.")+1));
run;

libname follow1 "/sasdata/MACME/PRD/CAMPAIGNS/&amp;amp;retval"; 

%mend returnfoldername;

%returnfoldername(key_985632=12772)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Naturally, I can't test this, but you can!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, in the case where&amp;nbsp;&lt;FONT face="courier new,courier"&gt;if index(process,"&amp;amp;key_985632.")&amp;gt;0 ;&lt;/FONT&gt; fails, you will not assign a value to &amp;amp;retval and so your libname statement will likely be incorrect, you might want to build in some error checking for this case.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 13:50:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-assign-libname-with-macro/m-p/846795#M334750</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-11-29T13:50:56Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot assign libname with macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-assign-libname-with-macro/m-p/846846#M334785</link>
      <description>&lt;P&gt;If you want to return a macro variable from a macro then just make sure the macro variable exists before calling the macro.&lt;/P&gt;
&lt;PRE&gt;2459  %macro mymacro(parameter);
2460  %let mymvar=&amp;amp;parameter;
2461  %mend;
2462  %let mymvar=BEFORE MACRO CALL;
2463  %put &amp;amp;=mymvar;
MYMVAR=BEFORE MACRO CALL
2464  %mymacro(after macro call);
2465  %put &amp;amp;=mymvar;
MYMVAR=after macro call
&lt;/PRE&gt;
&lt;P&gt;You can even use the %SYMEXIST() function to check if the macro variable exists or not.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro mymacro(parameter);
  %if not %symexist(mymvar) %then %global mymvar;
  %let mymvar=&amp;amp;parameter;
%mend;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Nov 2022 16:02:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-assign-libname-with-macro/m-p/846846#M334785</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-11-29T16:02:26Z</dc:date>
    </item>
  </channel>
</rss>

