<?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: Rename variable names using macro or array in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541216#M7328</link>
    <description>&lt;P&gt;Fen&amp;amp;varname(I) references an array that apparently has not been created yet. Or at least I do not see anything like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Array Fen&amp;amp;varname ...&lt;/P&gt;
&lt;P&gt;Same for MALE&amp;amp;varname,&amp;nbsp;UNK&amp;amp;varname,&amp;nbsp;Tot&amp;amp;varname and Null&amp;amp;varname. Each array you want to use must have an associated ARRAY definition statement.&lt;/P&gt;</description>
    <pubDate>Thu, 07 Mar 2019 20:49:20 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-03-07T20:49:20Z</dc:date>
    <item>
      <title>Rename variable names using macro or array</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541184#M7318</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am writing a program that creates, manipulates, and later combines datasets from numerous CSV files that are all structured differently.&amp;nbsp; I have a program I wrote last year that works.&amp;nbsp; But, since I will be updating the dataset each year as new data is released, I would like to refine the code to make it smaller and more efficient.&amp;nbsp; The image below is an example of the raw data I am working with in the data step below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/27748i76E1458C4B29976E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is a copy of the code I &lt;EM&gt;&lt;U&gt;want&lt;/U&gt; &lt;/EM&gt;to work (emphasis on want).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro age_gender(year,n);
data age_gender&amp;amp;year;
	infile "&amp;amp;path\Table 1 - Unduplicated Users by Age and Gender &amp;amp;year..csv" firstobs=6 obs=&amp;amp;n dsd;
	input Site :$35. Gender $ AgeUnd_15 Age15_17 Age18_19 Age20_24 Age25_29 Age30_34 Age35_39 Age40_44 AgeOver_44 Total;
	year=&amp;amp;year;
	array varname {*} age: total;
	do i=1 to dim(varname);
		if propcase(gender)='Female' then Fem&amp;amp;varname{i} = varname{i};
			else if propcase(gender)='Male' then Male&amp;amp;varname{i} = varname{i};
			else if propcase(gender)='Unknown' then Unk&amp;amp;varname{i} = varname{i};
			else if propcase(gender)='Total' then Tot&amp;amp;varname{i} = varname{i};
			else if gender='--- Null' then Null&amp;amp;varname{i} = varname{i};
	end;
	drop AgeUnd_15 Age15_17 Age18_19 Age20_24 Age25_29 Age30_34 Age35_39 Age40_44 AgeOver_44 Total;
run;
%mend;
%age_gender(2015,210);
%age_gender(2016,207);
%age_gender(2017,205);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;As it is, SAS is not recognizing my use of prefix and array reference to rename variables to categorize by gender.&amp;nbsp; I would greatly appreciate any insights as to how I may correct the syntax for the program I am trying to write, or if there is a better way to do this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ted&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 19:16:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541184#M7318</guid>
      <dc:creator>LEINAARE</dc:creator>
      <dc:date>2019-03-07T19:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variable names using macro or array</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541185#M7319</link>
      <description>&lt;P&gt;What are the variable names in the SAS data set that has been created?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;SAS is not recognizing my use of prefix and array reference to rename variables to categorize by gender.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Why do you say this? What error do you see? Show us the SAS Log by clicking on the {i} icon and pasting the log into the window that appears DO NOT SKIP THIS STEP.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 19:23:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541185#M7319</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-03-07T19:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variable names using macro or array</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541190#M7320</link>
      <description>&lt;P&gt;I am sorry, but for some reason it would not allow me to copy and past into the { i } text box.&amp;nbsp; Below is an image of my log.&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/27750i71BD7E64F00CC21D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 19:33:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541190#M7320</guid>
      <dc:creator>LEINAARE</dc:creator>
      <dc:date>2019-03-07T19:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variable names using macro or array</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541194#M7321</link>
      <description>&lt;P&gt;When you copy and paste the log, you need to copy the text and paste the text (not a screen capture) into the {i} window.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;We also need to know your variable names in the SAS data set.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 19:44:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541194#M7321</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-03-07T19:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variable names using macro or array</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541197#M7322</link>
      <description>&lt;P&gt;The { I } window is still not allowing me to cut and paste from my log.&amp;nbsp; The best I could do was attach a screen shot as a picture.&amp;nbsp; I'm sorry for the inconvenience, I don't know why it is not letting me copy the text and paste it in the text box.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The variables names are:&lt;/P&gt;&lt;P&gt;AgeUnd_15,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Age15_17,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Age18_19,&lt;/P&gt;&lt;P&gt;Age20_24,&lt;/P&gt;&lt;P&gt;Age25_29,&lt;/P&gt;&lt;P&gt;Age30_34,&lt;/P&gt;&lt;P&gt;Age35_39,&lt;/P&gt;&lt;P&gt;Age40_44,&lt;/P&gt;&lt;P&gt;AgeOver_44,&lt;/P&gt;&lt;P&gt;Total&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 19:49:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541197#M7322</guid>
      <dc:creator>LEINAARE</dc:creator>
      <dc:date>2019-03-07T19:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variable names using macro or array</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541200#M7323</link>
      <description>&lt;P&gt;Well, I don't know why it wouldn't allow text from your SAS log to be pasted, do you get an error message?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is a problem, as your screen capture is unreadable, to be honest.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 19:54:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541200#M7323</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-03-07T19:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variable names using macro or array</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541216#M7328</link>
      <description>&lt;P&gt;Fen&amp;amp;varname(I) references an array that apparently has not been created yet. Or at least I do not see anything like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Array Fen&amp;amp;varname ...&lt;/P&gt;
&lt;P&gt;Same for MALE&amp;amp;varname,&amp;nbsp;UNK&amp;amp;varname,&amp;nbsp;Tot&amp;amp;varname and Null&amp;amp;varname. Each array you want to use must have an associated ARRAY definition statement.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 20:49:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541216#M7328</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-03-07T20:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variable names using macro or array</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541227#M7330</link>
      <description>&lt;P&gt;No.&amp;nbsp; It does nothing when I try to paste into it.&amp;nbsp; I am pasting directly to this message below, if this is any more helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2679 %age_gender(2015,210);&lt;/P&gt;&lt;P&gt;SYMBOLGEN: Macro variable YEAR resolves to 2015&lt;/P&gt;&lt;P&gt;SYMBOLGEN: Macro variable PATH resolves to S:\Choose Well Evaluation\Data Management\Project&lt;/P&gt;&lt;P&gt;1\Data Files\DHEC_Data - Copy&lt;/P&gt;&lt;P&gt;SYMBOLGEN: Macro variable YEAR resolves to 2015&lt;/P&gt;&lt;P&gt;SYMBOLGEN: Macro variable N resolves to 210&lt;/P&gt;&lt;P&gt;SYMBOLGEN: Macro variable YEAR resolves to 2015&lt;/P&gt;&lt;P&gt;NOTE: Line generated by the invoked macro "AGE_GENDER".&lt;/P&gt;&lt;P&gt;2 year=&amp;amp;year; array varname {*} age: total; do i=1 to dim(varname); if&lt;/P&gt;&lt;P&gt;2 ! propcase(gender)='Female' then Fem&amp;amp;varname{i} = varname{i}; else if&lt;/P&gt;&lt;P&gt;---&lt;/P&gt;&lt;P&gt;180&lt;/P&gt;&lt;P&gt;2 ! propcase(gender)='Male' then Male&amp;amp;varname{i} = varname{i}; else if propcase&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference VARNAME not resolved.&lt;/P&gt;&lt;P&gt;NOTE: Line generated by the invoked macro "AGE_GENDER".&lt;/P&gt;&lt;P&gt;2 year=&amp;amp;year; array varname {*} age: total; do i=1 to dim(varname); if&lt;/P&gt;&lt;P&gt;2 ! propcase(gender)='Female' then Fem&amp;amp;varname{i} = varname{i}; else if&lt;/P&gt;&lt;P&gt;2 ! propcase(gender)='Male' then Male&amp;amp;varname{i} = varname{i}; else if propcase&lt;/P&gt;&lt;P&gt;----&lt;/P&gt;&lt;P&gt;180&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference VARNAME not resolved.&lt;/P&gt;&lt;P&gt;NOTE: Line generated by the invoked macro "AGE_GENDER".&lt;/P&gt;&lt;P&gt;3 (gender)='Unknown' then Unk&amp;amp;varname{i} = varname{i}; else if&lt;/P&gt;&lt;P&gt;---&lt;/P&gt;&lt;P&gt;180&lt;/P&gt;&lt;P&gt;3 ! propcase(gender)='Total' then Tot&amp;amp;varname{i} = varname{i}; else if gender='---&lt;/P&gt;&lt;P&gt;3 ! Null' then Null&amp;amp;varname{i} = varname{i}; end; drop AgeUnd_15 Age15_17 Age18_19&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference VARNAME not resolved.&lt;/P&gt;&lt;P&gt;NOTE: Line generated by the invoked macro "AGE_GENDER".&lt;/P&gt;&lt;P&gt;3 (gender)='Unknown' then Unk&amp;amp;varname{i} = varname{i}; else if&lt;/P&gt;&lt;P&gt;3 ! propcase(gender)='Total' then Tot&amp;amp;varname{i} = varname{i}; else if gender='---&lt;/P&gt;&lt;P&gt;---&lt;/P&gt;&lt;P&gt;180&lt;/P&gt;&lt;P&gt;3 ! Null' then Null&amp;amp;varname{i} = varname{i}; end; drop AgeUnd_15 Age15_17 Age18_19&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference VARNAME not resolved.&lt;/P&gt;&lt;P&gt;NOTE: Line generated by the invoked macro "AGE_GENDER".&lt;/P&gt;&lt;P&gt;3 (gender)='Unknown' then Unk&amp;amp;varname{i} = varname{i}; else if&lt;/P&gt;&lt;P&gt;3 ! propcase(gender)='Total' then Tot&amp;amp;varname{i} = varname{i}; else if gender='---&lt;/P&gt;&lt;P&gt;3 ! Null' then Null&amp;amp;varname{i} = varname{i}; end; drop AgeUnd_15 Age15_17 Age18_19&lt;/P&gt;&lt;P&gt;----&lt;/P&gt;&lt;P&gt;180&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference VARNAME not resolved.&lt;/P&gt;&lt;P&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/P&gt;&lt;P&gt;WARNING: The data set WORK.AGE_GENDER2015 may be incomplete. When this step was stopped there were&lt;/P&gt;&lt;P&gt;0 observations and 4 variables.&lt;/P&gt;&lt;P&gt;WARNING: Data set WORK.AGE_GENDER2015 was not replaced because this step was stopped.&lt;/P&gt;&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;/P&gt;&lt;P&gt;real time 0.08 seconds&lt;/P&gt;&lt;P&gt;cpu time 0.06 seconds&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 21:11:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541227#M7330</guid>
      <dc:creator>LEINAARE</dc:creator>
      <dc:date>2019-03-07T21:11:42Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variable names using macro or array</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541228#M7331</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did not realize it was treating each prefix as a different array.&amp;nbsp; I was wanting to the variable referenced in varname{ i } to be assigned to each prefix (Male, Unk, Tot, etc.) as variable names.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 21:15:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541228#M7331</guid>
      <dc:creator>LEINAARE</dc:creator>
      <dc:date>2019-03-07T21:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variable names using macro or array</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541232#M7333</link>
      <description>&lt;P&gt;You defined an array using the name VARNAME.&lt;/P&gt;
&lt;P&gt;Then later you are using a macro variable that just happens to also have the same name , VARNAME, to generate a reference to a different array whose name starts with the letters FEM.&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you define that other array?&lt;/P&gt;
&lt;P&gt;What value did you think you had put into the macro variable VARNAME?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that SAS is saying that the macro variable VARNAME has not been defined.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 21:33:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541232#M7333</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-03-07T21:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variable names using macro or array</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541234#M7334</link>
      <description>&lt;P&gt;If you can copy the text from the SASLOG then you should be able to paste it into the pop-up windows in the forum.&amp;nbsp; Can you paste any text into the pop-up windows of the forum? if not try a different browser (chrome, IE, Safari, Firefox, etc.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 21:38:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541234#M7334</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-03-07T21:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variable names using macro or array</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541237#M7335</link>
      <description>&lt;P&gt;I am still quite novice with using arrays.&amp;nbsp; I thought it would append the variable name for the current iteration of the array to each prefix.&amp;nbsp; For instance, in the first line of code within the array:&lt;/P&gt;&lt;P&gt;"if propcase(gender)='Female' then Fem&amp;amp;varname{i} = varname{i};"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought it would created a variable named "FemAgeUnd_15" &lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;after the first variable referenced in the array "AgeUnd_15" &lt;/SPAN&gt;and assign it the newly named variable the value of the original variable. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 21:44:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541237#M7335</guid>
      <dc:creator>LEINAARE</dc:creator>
      <dc:date>2019-03-07T21:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variable names using macro or array</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541243#M7337</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;, and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you all for your help with this issue.&amp;nbsp; I devised an alternate approach that I believe may work, where I reference a macro program within a macro program.&amp;nbsp; The code I wrote is below, and it appears to work.&amp;nbsp; I think I will go this route for now.&amp;nbsp; Thank you again for your help.&amp;nbsp; I would appreciate your thoughts on this code as well because, if it proves to have created the desired results, I plan to replicate this method throughout.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ted&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro rename(pref);
	&amp;amp;pref.AgeUnd_15=AgeUnd_15; &amp;amp;pref.Age15_17=Age15_17; &amp;amp;pref.Age18_19=Age18_19;
	&amp;amp;pref.Age20_24=Age20_24; &amp;amp;pref.Age25_29=Age25_29; &amp;amp;pref.Age30_34=Age30_34;
	&amp;amp;pref.Age35_39=Age35_39; &amp;amp;pref.Age40_44=Age40_44; &amp;amp;pref.AgeOver_44=AgeOver_44;
    &amp;amp;pref.Total=Total;
%mend;
%macro age_gender(year,n);
data age_gender&amp;amp;year;
	infile "&amp;amp;path\Table 1 - Unduplicated Users by Age and Gender &amp;amp;year..csv" firstobs=6 obs=&amp;amp;n dsd;
	input Site :$35. Gender $ AgeUnd_15 Age15_17 Age18_19 Age20_24 Age25_29 Age30_34 Age35_39 Age40_44 AgeOver_44 Total;
	year=&amp;amp;year;
	if propcase(gender)='Female' then %rename(Fem);
	if propcase(gender)='Male' then %rename(Male);
	if propcase(gender)='Unknown' then %rename(Unk);
	if propcase(gender)='Total' then %rename(Tot);
	if gender='--- Null' then %rename(Null);
	drop AgeUnd_15 Age15_17 Age18_19 Age20_24 Age25_29 Age30_34 Age35_39 Age40_44 AgeOver_44 Total;
run;
%mend;
%age_gender(2015,210);
%age_gender(2016,207);
%age_gender(2017,205);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Mar 2019 21:58:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Rename-variable-names-using-macro-or-array/m-p/541243#M7337</guid>
      <dc:creator>LEINAARE</dc:creator>
      <dc:date>2019-03-07T21:58:32Z</dc:date>
    </item>
  </channel>
</rss>

