<?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 Macro to run variables through a procedure--showing labels in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Macro-to-run-variables-through-a-procedure-showing-labels/m-p/627354#M20521</link>
    <description>&lt;P&gt;I have a dataset with 28 analytes (e.g., glucose, creatinine, calcium) that I want to run through the same procedure.&amp;nbsp; To do so, I renamed all 29 analytes as x1 through x28 (to avoid having to make 28 calls to the macro), created a macro, and generated labels in a prior data step to keep track of what each one represented.&amp;nbsp; However, when running the macro, the labels are not attached, so the results are not quickly identifiable as pertaining to a given analyte.&amp;nbsp; I would like to be able to look at the results and know that this one is for glucose, this one for creatinine, etc.&amp;nbsp; How can I get the label/actual analyte name to display in the title?&amp;nbsp; I tried including "OPTION LABEL" in the macro to no avail.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO linear_trend;
	%DO i=1 %TO 28;
	PROC MIXED DATA = analytes;
		CLASS patient_id week;
		MODEL x&amp;amp;i = date / SOLUTION;
		RANDOM INT / SUBJECT = patient_id;
		RANDOM INT / SUBJECT = week(patient_id);
                TITLE1 "Linear trend for x&amp;amp;i";
	RUN;
	%END;
%MEND linear_trend;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The data have the form:&lt;/P&gt;&lt;P&gt;patient_id&amp;nbsp; week&amp;nbsp; x1&amp;nbsp;&amp;nbsp;&amp;nbsp; x2&amp;nbsp;&amp;nbsp;&amp;nbsp; x3 .... x28&lt;/P&gt;&lt;P&gt;123&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp;&amp;nbsp; 9.1&amp;nbsp; 3.6 &amp;nbsp; 7.2 .....&lt;/P&gt;&lt;P&gt;123&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9.2&amp;nbsp; 3.6&amp;nbsp;&amp;nbsp; 7.4 .....&lt;/P&gt;&lt;P&gt;123&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8.7&amp;nbsp; 3.7&amp;nbsp;&amp;nbsp; 7.5 .....&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;</description>
    <pubDate>Tue, 25 Feb 2020 22:20:55 GMT</pubDate>
    <dc:creator>patrick5</dc:creator>
    <dc:date>2020-02-25T22:20:55Z</dc:date>
    <item>
      <title>Macro to run variables through a procedure--showing labels</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-to-run-variables-through-a-procedure-showing-labels/m-p/627354#M20521</link>
      <description>&lt;P&gt;I have a dataset with 28 analytes (e.g., glucose, creatinine, calcium) that I want to run through the same procedure.&amp;nbsp; To do so, I renamed all 29 analytes as x1 through x28 (to avoid having to make 28 calls to the macro), created a macro, and generated labels in a prior data step to keep track of what each one represented.&amp;nbsp; However, when running the macro, the labels are not attached, so the results are not quickly identifiable as pertaining to a given analyte.&amp;nbsp; I would like to be able to look at the results and know that this one is for glucose, this one for creatinine, etc.&amp;nbsp; How can I get the label/actual analyte name to display in the title?&amp;nbsp; I tried including "OPTION LABEL" in the macro to no avail.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO linear_trend;
	%DO i=1 %TO 28;
	PROC MIXED DATA = analytes;
		CLASS patient_id week;
		MODEL x&amp;amp;i = date / SOLUTION;
		RANDOM INT / SUBJECT = patient_id;
		RANDOM INT / SUBJECT = week(patient_id);
                TITLE1 "Linear trend for x&amp;amp;i";
	RUN;
	%END;
%MEND linear_trend;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The data have the form:&lt;/P&gt;&lt;P&gt;patient_id&amp;nbsp; week&amp;nbsp; x1&amp;nbsp;&amp;nbsp;&amp;nbsp; x2&amp;nbsp;&amp;nbsp;&amp;nbsp; x3 .... x28&lt;/P&gt;&lt;P&gt;123&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp;&amp;nbsp; 9.1&amp;nbsp; 3.6 &amp;nbsp; 7.2 .....&lt;/P&gt;&lt;P&gt;123&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9.2&amp;nbsp; 3.6&amp;nbsp;&amp;nbsp; 7.4 .....&lt;/P&gt;&lt;P&gt;123&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8.7&amp;nbsp; 3.7&amp;nbsp;&amp;nbsp; 7.5 .....&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2020 22:20:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-to-run-variables-through-a-procedure-showing-labels/m-p/627354#M20521</guid>
      <dc:creator>patrick5</dc:creator>
      <dc:date>2020-02-25T22:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to run variables through a procedure--showing labels</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-to-run-variables-through-a-procedure-showing-labels/m-p/627357#M20523</link>
      <description>&lt;P&gt;What happens if you run the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	PROC MIXED DATA = analytes;
		CLASS patient_id week;
		MODEL x1-x28 = date / SOLUTION;
		RANDOM INT / SUBJECT = patient_id;
		RANDOM INT / SUBJECT = week(patient_id);
	RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Feb 2020 22:40:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-to-run-variables-through-a-procedure-showing-labels/m-p/627357#M20523</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-02-25T22:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to run variables through a procedure--showing labels</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-to-run-variables-through-a-procedure-showing-labels/m-p/627358#M20524</link>
      <description>&lt;P&gt;Other options, I would recommend transposing your data and then running regression using the BY statement instead. This is illustrated in this blog post:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2017/02/13/run-1000-regressions.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2017/02/13/run-1000-regressions.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Transposing data tutorials:&lt;BR /&gt;Wide to Long:&lt;BR /&gt;&lt;A href="https://stats.idre.ucla.edu/sas/modules/how-to-reshape-data-wide-to-long-using-proc-transpose/" target="_blank"&gt;https://stats.idre.ucla.edu/sas/modules/how-to-reshape-data-wide-to-long-using-proc-transpose/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://stats.idre.ucla.edu/sas/modules/reshaping-data-wide-to-long-using-a-data-step/" target="_blank"&gt;https://stats.idre.ucla.edu/sas/modules/reshaping-data-wide-to-long-using-a-data-step/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;A simple reformatting of your data will make your life infinitely easier, your code will be dynamic and adjust to an increase/decrease automatically and the results are easier to collate into a single data set, when you get to that point.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/264400"&gt;@patrick5&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have a dataset with 28 analytes (e.g., glucose, creatinine, calcium) that I want to run through the same procedure.&amp;nbsp; To do so, I renamed all 29 analytes as x1 through x28 (to avoid having to make 28 calls to the macro), created a macro, and generated labels in a prior data step to keep track of what each one represented.&amp;nbsp; However, when running the macro, the labels are not attached, so the results are not quickly identifiable as pertaining to a given analyte.&amp;nbsp; I would like to be able to look at the results and know that this one is for glucose, this one for creatinine, etc.&amp;nbsp; How can I get the label/actual analyte name to display in the title?&amp;nbsp; I tried including "OPTION LABEL" in the macro to no avail.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO linear_trend;
	%DO i=1 %TO 28;
	PROC MIXED DATA = analytes;
		CLASS patient_id week;
		MODEL x&amp;amp;i = date / SOLUTION;
		RANDOM INT / SUBJECT = patient_id;
		RANDOM INT / SUBJECT = week(patient_id);
                TITLE1 "Linear trend for x&amp;amp;i";
	RUN;
	%END;
%MEND linear_trend;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The data have the form:&lt;/P&gt;
&lt;P&gt;patient_id&amp;nbsp; week&amp;nbsp; x1&amp;nbsp;&amp;nbsp;&amp;nbsp; x2&amp;nbsp;&amp;nbsp;&amp;nbsp; x3 .... x28&lt;/P&gt;
&lt;P&gt;123&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp;&amp;nbsp; 9.1&amp;nbsp; 3.6 &amp;nbsp; 7.2 .....&lt;/P&gt;
&lt;P&gt;123&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9.2&amp;nbsp; 3.6&amp;nbsp;&amp;nbsp; 7.4 .....&lt;/P&gt;
&lt;P&gt;123&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8.7&amp;nbsp; 3.7&amp;nbsp;&amp;nbsp; 7.5 .....&lt;/P&gt;
&lt;P&gt;.....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2020 22:42:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-to-run-variables-through-a-procedure-showing-labels/m-p/627358#M20524</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-02-25T22:42:08Z</dc:date>
    </item>
  </channel>
</rss>

